From d3cbe45608ac8b31977e9d6e6b20accbb36af4a0 Mon Sep 17 00:00:00 2001 From: navjot Date: Thu, 31 Oct 2019 16:24:18 +0530 Subject: [PATCH 01/22] worked on implementing loader popup functionality on account switching --- src/bitmessagekivy/main.kv | 17 ++++++- src/bitmessagekivy/mpybit.py | 95 +++++++++++++++++++++-------------- src/buildozer.spec | 2 +- src/images/3.zip | Bin 0 -> 3043 bytes src/images/loader.gif | Bin 0 -> 13527 bytes src/images/loader.zip | Bin 0 -> 15918 bytes 6 files changed, 75 insertions(+), 39 deletions(-) create mode 100644 src/images/3.zip create mode 100644 src/images/loader.gif create mode 100644 src/images/loader.zip diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 759bd71c..48c7d889 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -14,6 +14,7 @@ #:import MDFloatingActionButton kivymd.button.MDFloatingActionButton #:import Factory kivy.factory.Factory #:import MDScrollViewRefreshLayout kivymd.refreshlayout.MDScrollViewRefreshLayout +#:import MDSpinner kivymd.spinner.MDSpinner #:set color_button (0.784, 0.443, 0.216, 1) # brown #:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown @@ -29,7 +30,7 @@ color: color_font : - drawer_logo: app.address_identicon() + drawer_logo: './images/drawer_logo1.png' NavigationDrawerDivider: NavigationDrawerSubheader: text: "Accounts" @@ -1204,3 +1205,17 @@ NavigationLayout: id: search_field hint_text: 'Search' on_text: app.searchQuery(self) + + +: + separator_color: 1, 1, 1, 1 + background: "White.png" + Button: + id: btn + disabled: True + background_disabled_normal: "White.png" + Image: + source: './images/loader.zip' + anim_delay: 0 + #mipmap: True + size: root.size \ No newline at end of file diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 7270514b..14ea7e8f 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1026,10 +1026,25 @@ class NavigateApp(App): self.root_window.children[1].ids.toolbar.title = address_label state.association = text state.searcing_text = '' + LoadingPopup().open() self.root.ids.sc1.ids.ml.clear_widgets() self.root.ids.sc1.loadMessagelist(state.association) + + self.root.ids.sc4.ids.ml.clear_widgets() + self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' + self.root.ids.sc4.loadSent(state.association) + + self.root.ids.sc16.clear_widgets() + self.root.ids.sc16.add_widget(Draft()) + + self.root.ids.sc5.clear_widgets() + self.root.ids.sc5.add_widget(Trash()) + + self.root.ids.sc17.clear_widgets() + self.root.ids.sc17.add_widget(Allmails()) + self.root.ids.scr_mngr.current = 'inbox' - msg_counter_objs = self.root_window.children[1].children[2].children[0].ids + msg_counter_objs = self.root_window.children[2].children[2].children[0].ids state.sent_count = str( sqlQuery( "SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and" @@ -1224,37 +1239,37 @@ class NavigateApp(App): def refreshScreen(self, instance): """Method show search button only on inbox or sent screen.""" state.searcing_text = '' - if instance.text == 'Sent': - self.root.ids.sc4.ids.ml.clear_widgets() - self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' - self.root.ids.sc4.loadSent(state.association) - elif instance.text == 'Inbox': - self.root.ids.sc1.ids.ml.clear_widgets() - try: - self.root.ids.sc1.children[2].children[1].ids.search_field.text = '' - except Exception: - self.root.ids.sc1.children[1].children[1].ids.search_field.text = '' - self.root.ids.sc1.loadMessagelist(state.association) - elif instance.text == 'Draft': - self.root.ids.sc16.clear_widgets() - self.root.ids.sc16.add_widget(Draft()) - elif instance.text == 'Trash': - self.root.ids.sc5.clear_widgets() - self.root.ids.sc5.add_widget(Trash()) - elif instance.text == 'All Mails': - self.root.ids.sc17.clear_widgets() - self.root.ids.sc17.add_widget(Allmails()) - elif instance.text == 'Address Book': - self.root.ids.sc11.ids.ml.clear_widgets() - self.root.ids.sc11.children[1].children[1].ids.search_field.text = '' - self.root.ids.sc11.loadAddresslist(None, 'All', '') - elif instance.text == 'My Addresses': - self.root.ids.sc10.ids.ml.clear_widgets() - try: - self.root.ids.sc10.children[1].children[1].ids.search_field.text = '' - except Exception: - self.root.ids.sc10.children[2].children[1].ids.search_field.text = '' - self.root.ids.sc10.init_ui() + # if instance.text == 'Sent': + # self.root.ids.sc4.ids.ml.clear_widgets() + # self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' + # self.root.ids.sc4.loadSent(state.association) + # elif instance.text == 'Inbox': + # self.root.ids.sc1.ids.ml.clear_widgets() + # try: + # self.root.ids.sc1.children[2].children[1].ids.search_field.text = '' + # except Exception: + # self.root.ids.sc1.children[1].children[1].ids.search_field.text = '' + # self.root.ids.sc1.loadMessagelist(state.association) + # elif instance.text == 'Draft': + # self.root.ids.sc16.clear_widgets() + # self.root.ids.sc16.add_widget(Draft()) + # elif instance.text == 'Trash': + # self.root.ids.sc5.clear_widgets() + # self.root.ids.sc5.add_widget(Trash()) + # elif instance.text == 'All Mails': + # self.root.ids.sc17.clear_widgets() + # self.root.ids.sc17.add_widget(Allmails()) + # elif instance.text == 'Address Book': + # self.root.ids.sc11.ids.ml.clear_widgets() + # self.root.ids.sc11.children[1].children[1].ids.search_field.text = '' + # self.root.ids.sc11.loadAddresslist(None, 'All', '') + # elif instance.text == 'My Addresses': + # self.root.ids.sc10.ids.ml.clear_widgets() + # try: + # self.root.ids.sc10.children[1].children[1].ids.search_field.text = '' + # except Exception: + # self.root.ids.sc10.children[2].children[1].ids.search_field.text = '' + # self.root.ids.sc10.init_ui() return def set_identicon(self, text): @@ -1262,11 +1277,6 @@ class NavigateApp(App): img = identiconGeneration.generate(text) self.root.children[2].children[0].ids.btn.children[1].texture = img.texture - @staticmethod - def address_identicon(): - """Address identicon""" - return './images/drawer_logo1.png' - def set_mail_detail_header(self): """Method is used for setting the details of the page""" toolbar_obj = self.root.ids.toolbar @@ -1966,3 +1976,14 @@ class Spam(Screen): """Spam Screen show widgets of page.""" pass + + +class LoadingPopup(Popup): + + def __init__(self, **kwargs): + super(LoadingPopup, self).__init__(**kwargs) + # call dismiss_popup in 2 seconds + Clock.schedule_once(self.dismiss_popup, 0.5) + + def dismiss_popup(self, dt): + self.dismiss() \ No newline at end of file diff --git a/src/buildozer.spec b/src/buildozer.spec index 444bf8ca..0dfeb191 100644 --- a/src/buildozer.spec +++ b/src/buildozer.spec @@ -13,7 +13,7 @@ package.domain = org.test source.dir = . # (list) Source files to include (let empty to include all the files) -source.include_exts = py,png,jpg,kv,atlas +source.include_exts = py,png,jpg,kv,atlas,gif,zip # (list) List of inclusions using pattern matching #source.include_patterns = assets/*,images/*.png diff --git a/src/images/3.zip b/src/images/3.zip new file mode 100644 index 0000000000000000000000000000000000000000..34d555fed251e96b6493497f61d8078c8cb68b5c GIT binary patch literal 3043 zcmV<93mo)NO9KQH00;;O0A-b3PXGV_000000000000jU505dLUX=ZJfcT`hb7KiV> zx%cMYfC?c%kYYf>0||-duO{tV9awgDe99NSI)-&U&S<1wf~nE;=)hbKLvT#+8%S zOu}LKZ|0kpESD#M^e_I#;>)l_tc&2>_HfKZrckJ|T zMi|6~)!k`6d0*oV>5E@vThytZNGjp#kaGGd0$ZZe-SV8I_80N*MIUYYHXXk1ceF2T z9t=|gy04!NoOSxjRbKT(|DE;phJfe4eSHd4MG=o*&RjkJwf1it6Q3+P6QZOg4u20( z7Si848oEUg&7VDp1OlWP&g_cM8i5a8Jwz~dFUy_2!ag(a;uXtGCuDI?_UcI0mDRW5 zRULDbRGF-NE%fo_ytT$ihw|7(rTasgPVy`D+>!0}_D|!?NYvSw*_zMCFKsN$(?Ggh zM}Fej%|}>d@4HY@%(u2@|HNTG=9lLAam_}upSQlyiK`i;TciMYe)i<-yY@m*BEQ$H zDqkr;`ZO!}eBOy-$~H__aBQBp23b^DhhL7?qG}#moDNsqp>8$ll$%cKIC*XzH0;T$ zdY>oISnZ_uSBLqUFz+ohw<<+jNIMJsDmw0xp5*vi6?kY4X>0{6_&>)l%sNBd&4B^_ zeo5suC!TsLl}GAGR7<%zUO{!g({qbD!awEYp4)gOuA$~mL1t6#WnWAbKU>cCAk z@W07*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LwPSzQ7tNrEm;|6*h=d*1R@lGg{ef)yV zXOJBl2A)&m1o@*Nh8cLlX;_e%QM~n~v^)Rca3T?mCbNo*%S^$l>S~OG zw_)uh5-8FUjj@x#6q6 zCNtR$2Ba_bDe-ReRrs$wfvP*Nj)KKmI3RRkWzISU87fo8xxs|=G)zP&aM7zrq#(sul2U0I zC{E8K;%InaeOV(JDo(h7=3u?OZF=aH>v(iu??qz>93B}NZD$_HIT)_^O_a`muZ2}} zLRvD-B&#Cqf|4K^dD(u-eQHj@&?Se6=t0#S83n;IR_Q|% zAGIE4BUc_+#S`5)4gJm;(>#-ft+BJI^?TpRcFgnz;8XjPv6BAPHPLt7bgUNc=;Fb_wd0^{508mQ@ z2tuCXq-P5N00;~K08mQ-0u%rg00;;O0A-b3PePvJq-P5N00;~K00jU50000000000 l000000000pE@x?GP)h{{000000RRC2GXMYpnhO8`002Iqx!nK& literal 0 HcmV?d00001 diff --git a/src/images/loader.gif b/src/images/loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..29064d5795d97c6c88cf5ef5332461e8e2b312dc GIT binary patch literal 13527 zcmeI2=T}pI*X9pJ2&4+ANDYMEOXww`NH3w-MI)esm8OEUP=wH{f&~plK>?+N4ib8( zp?5SC6{HwC2*~iepLu5PH#2kp0dw;5tZ&vz&b9Zs_UGEB<|dk2*F%{0fo);n|6l*d zf8Y?XwzhV3bUb(N+{KF*ot&JmU%!6i#*LddZ{E6f%gxQr-QE56?b~Yo;`d1{CQehT6%i=ix)3mzI^%W)vMR9UuR@wym|BH?c28` z5-Bq?Gb<}AJ3BikC+FR}ckkc7&&|!v%gg)l;lsy|AM^9`3knJf3kyGe`t z*x1z6)ZEb& z;NalU(9rPk@W{x>=;-L!*x2~^_{7A-AFTW@cw+=jP_V zfB*jD$B&;sf6mX(FDxwl`t@sZadByBX?b~hWo6~}@81jtV|8_PZEbCReSKqNV{>zJ zYinzJdwXYRXLon^&!0bgdwcu)`v(UHfB*hHJUkRR1lyc(bTBf&ol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@kbH@VMjDc>A$R4*=7 zMsetoyWH`50OdU5{i?@NdilM`|E1+3&LK{%-;tYk;g|@oIEB5=I6-r0DF&*!H9yd8 z*m5!zhncZ*Im(U*M)23iFS4iTjGDPX)%f_qp4S51qdnF72{+b4fm#Qs+Q^j@YaMQ( z2^;iJn`{{6ToRA1`l;aTLi?6q1MwR3^cU;y2lFWSSzGoiYR$P$8ImUdx2~)6KL94{ BLgN4c literal 0 HcmV?d00001 diff --git a/src/images/loader.zip b/src/images/loader.zip new file mode 100644 index 0000000000000000000000000000000000000000..c80a3a17e22d05832db089959679ec1c995e0cb9 GIT binary patch literal 15918 zcmY*=LzE~AtYq7^ZQHhO+qP}nwr$(C-M4Lf-k;6z-Q3))tgY|%dZ*8xl9Q60oSb@k;`}~aDhdi1czAG7QCr(y zi@Ul$uhatt8eZ=WPfw@Qr>CYaFE2ZE?0kHBA|oY5MMaH`iL+3TSey^{ud#bCgy}ZWW-?>>?UlI}V!j;i+eAedY?L9n7dULloHdaZ(08wSIY7+1VL-$BrD{-AgigEHE(ed_I4COw7vClAMG@hu_cV$q7oX z+}rar4mNhb^O>Bzy}h8IprPU6;L=x z{466N5KvQd-RJuyL6Q_33mYor=;U;HeeL;ry;&-qh>4krPNx$SEiEA}JwG)?Nl9tU zbbRrAe{hh{Zof}QPahv2|KIihlcMtC;vynqT2itS1}u4WiqDgYf+gkl&VOipTwX{h zNT!X`>7*ifxL-@h*5+6B$kN=r-@P6+QlwA`esh}}6Z2+mog67r%*+g}sp-+ntDA_p z7zhX`9v>b83d+s>t)jZR-@pH8kJn9FIy){7E`GeaqQb`7+s@3ati1f~E*lFA3ldUN zyXNR4DLowYVqPvGs++M7C@T z3lo8`;E(1fYzRSsv*0cN=T8S2pc6PC;qev6O`JwaX1qLKc_%eO-Ib=Hp7ugAl?^WM zvYz&4nn0s`f_o(u*2EgO>KU`5o8Kkd!>D24Q1T?ht9qXo(o6S(d*%K7NBMK-fVaGy z6+ch3j@}=`>+}8C84RTOd}k!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S7Jld-E1ZAK=djBkaM6Z6zc6f-*QLEQq5(F{!}kz+wQw9U zD6bT@4xqYza3Ne2i1A?^V1sFXPA)1-L2-xu3O%-9b+hgaFm6bY^I^~_OV_mUvR`L% z_XnyV4G!^C?R3(_3jjdQ4*;Mb4G4q+@c(Sy|9kd7Ht+u*|JU@bAPoxkKW)JOg89FE K`X3bl!2bc@Mkc@j literal 0 HcmV?d00001 From fc347c3731eb6d5b764d2d4ce55445803e7f3b74 Mon Sep 17 00:00:00 2001 From: navjot Date: Mon, 4 Nov 2019 21:57:53 +0530 Subject: [PATCH 02/22] worked on new address creation time loader functionality --- src/bitmessagekivy/main.kv | 31 ++++------ src/bitmessagekivy/mpybit.py | 114 +++++++++++++++++++++-------------- 2 files changed, 80 insertions(+), 65 deletions(-) diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 48c7d889..63a7e009 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -58,52 +58,44 @@ text: "Inbox" on_release: app.root.ids.scr_mngr.current = 'inbox' badge_text: "0" - on_press: app.refreshScreen(self) NavigationDrawerIconButton: id: send_cnt icon: 'send' text: "Sent" on_release: app.root.ids.scr_mngr.current = 'sent' badge_text: "0" - on_press: app.refreshScreen(self) NavigationDrawerIconButton: id: draft_cnt icon: 'message-draw' text: "Draft" on_release: app.root.ids.scr_mngr.current = 'draft' badge_text: "0" - on_press: app.refreshScreen(self) NavigationDrawerIconButton: text: "Starred" icon:'star' on_release: app.root.ids.scr_mngr.current = 'starred' - on_press: app.refreshScreen(self) NavigationDrawerIconButton: icon: 'archive' text: "Archieve" on_release: app.root.ids.scr_mngr.current = 'archieve' badge_text: "0" - on_press: app.refreshScreen(self) NavigationDrawerIconButton: icon: 'email-open-outline' text: "Spam" on_release: app.root.ids.scr_mngr.current = 'spam' badge_text: "0" - on_press: app.refreshScreen(self) NavigationDrawerIconButton: id: trash_cnt icon: 'delete' text: "Trash" on_release: app.root.ids.scr_mngr.current = 'trash' badge_text: "0" - on_press: app.refreshScreen(self) NavigationDrawerIconButton: id: allmail_cnt text: "All Mails" icon:'contact-mail' on_release: app.root.ids.scr_mngr.current = 'allmails' badge_text: "0" - on_press: app.refreshScreen(self) NavigationDrawerDivider: NavigationDrawerSubheader: text: "All labels" @@ -111,37 +103,30 @@ text: "Address Book" icon:'book-multiple' on_release: app.root.ids.scr_mngr.current = 'addressbook' - on_press: app.refreshScreen(self) NavigationDrawerIconButton: text: "Settings" icon:'settings' on_release: app.root.ids.scr_mngr.current = 'set' - on_press: app.refreshScreen(self) NavigationDrawerIconButton: text: "Subscriptions/Payment" icon:'bell' on_release: app.root.ids.scr_mngr.current = 'payment' - on_press: app.refreshScreen(self) NavigationDrawerIconButton: text: "Credits" icon:'wallet' on_release: app.root.ids.scr_mngr.current = 'credits' - on_press: app.refreshScreen(self) NavigationDrawerIconButton: text: "new address" icon:'account-plus' on_release: app.root.ids.scr_mngr.current = 'login' - on_press: app.refreshScreen(self) NavigationDrawerIconButton: text: "Network Status" icon:'server-network' on_release: app.root.ids.scr_mngr.current = 'networkstat' - on_press: app.refreshScreen(self) NavigationDrawerIconButton: text: "My Addresses" icon:'account-multiple' on_release: app.root.ids.scr_mngr.current = 'myaddress' - on_press: app.refreshScreen(self) NavigationLayout: id: nav_layout @@ -179,7 +164,7 @@ NavigationLayout: id:sc6 Random: id:sc7 - AddressSuccessful: + Spam: id:sc8 Setting: id:sc9 @@ -205,8 +190,6 @@ NavigationLayout: id:sc19 Archieve: id:sc20 - Spam: - id:sc21 : name: 'inbox' @@ -221,6 +204,7 @@ NavigationLayout: root_layout: root MDList: id: ml + Loader: ComposerButton: : @@ -626,6 +610,7 @@ NavigationLayout: root_layout: root MDList: id: ml + Loader: ComposerButton: : @@ -1218,4 +1203,12 @@ NavigationLayout: source: './images/loader.zip' anim_delay: 0 #mipmap: True - size: root.size \ No newline at end of file + size: root.size + + +: + id: spinner + size_hint: None, None + size: dp(46), dp(46) + pos_hint: {'center_x': 0.5, 'center_y': 0.5} + active: False \ No newline at end of file diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 14ea7e8f..ec2a9f74 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -228,7 +228,7 @@ class Inbox(Screen): def refresh_callback(interval): """Method used for loading the inbox screen data.""" state.searcing_text = '' - self.children[2].children[1].ids.search_field.text = '' + self.children[3].children[1].ids.search_field.text = '' self.ids.ml.clear_widgets() self.loadMessagelist(state.association) self.ids.refresh_layout.refresh_done() @@ -301,7 +301,8 @@ class MyAddress(Screen): def refresh_callback(interval): """Method used for loading the myaddress screen data.""" state.searcing_text = '' - self.children[2].children[1].ids.search_field.text = '' + state.kivyapp.root.ids.sc10.children[2].active = False + self.children[3].children[1].ids.search_field.text = '' self.ids.ml.clear_widgets() self.init_ui() self.ids.refresh_layout.refresh_done() @@ -462,6 +463,7 @@ class DropDownWidget(BoxLayout): sendMessageToPeople = True if sendMessageToPeople: if toAddress != '' and subject and message: + # navApp.root.ids.sc1.children[1].active = True from addresses import decodeAddress status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress) if status == 'success': @@ -527,6 +529,7 @@ class DropDownWidget(BoxLayout): queues.workerQueue.put(('sendmessage', toAddress)) print "sqlExecute successfully #######################" self.parent.parent.current = 'inbox' + # navApp.root.ids.sc1.children[1].active = False state.in_composer = True navApp.back_press() toast('send') @@ -689,6 +692,7 @@ class Random(Screen): nonceTrialsPerByte = 1000 payloadLengthExtraBytes = 1000 if str(self.ids.label.text).strip(): + toast('Address Creating...') queues.addressGeneratorQueue.put(( 'createRandomAddress', 4, streamNumberForAddress, @@ -699,16 +703,15 @@ class Random(Screen): self.parent.parent.parent.parent.ids.toolbar.opacity = 1 self.parent.parent.parent.parent.ids.toolbar.disabled = False self.parent.parent.parent.parent.ids.sc10.ids.ml.clear_widgets() + self.parent.parent.parent.parent.ids.sc10.children[1].active = True self.manager.current = 'myaddress' - self.parent.parent.parent.parent.ids.sc10.init_ui() - self.manager.current = 'myaddress' - toast('New address created') + Clock.schedule_once(self.address_created_callback, 10) - -class AddressSuccessful(Screen): - """Getting Address Detail.""" - - pass + def address_created_callback(self, dt=0): + state.kivyapp.root.ids.sc10.children[1].active = False + state.kivyapp.root.ids.sc10.init_ui() + self.manager.current = 'myaddress' + toast('New address created') class Sent(Screen): @@ -1147,6 +1150,20 @@ class NavigateApp(App): self.root.ids.scr_mngr.transition.direction = 'right' self.root.ids.scr_mngr.transition.bind(on_complete=self.reset) return True + elif key == 13 and platform == 'android': + if state.search_screen == 'inbox': + self.root.ids.sc1.ids.ml.clear_widgets() + self.root.ids.sc1.loadMessagelist(state.association) + elif state.search_screen == 'addressbook': + self.root.ids.sc11.ids.ml.clear_widgets() + self.root.ids.sc11.loadAddresslist(None, 'All', '') + elif state.search_screen == 'myaddress': + self.root.ids.sc10.ids.ml.clear_widgets() + self.root.ids.sc10.init_ui() + else: + self.root.ids.sc4.ids.ml.clear_widgets() + self.root.ids.sc4.loadSent(state.association) + self.root.ids.scr_mngr.current = state.search_screen def reset(self, *args): """Method used to set transition direction.""" @@ -1222,54 +1239,59 @@ class NavigateApp(App): """Method used for showing searched mails.""" state.search_screen = self.root.ids.scr_mngr.current state.searcing_text = str(instance.text).strip() + if instance.focus and state.searcing_text: + toolbar_obj = self.root.ids.toolbar + toolbar_obj.left_action_items = [['close', lambda x: self.closeSearchScreen()]] + toolbar_obj.right_action_items = [] + self.root.ids.toolbar.title = '' + if platform == 'linux': + if state.search_screen == 'inbox': + self.root.ids.sc1.ids.ml.clear_widgets() + self.root.ids.sc1.loadMessagelist(state.association) + elif state.search_screen == 'addressbook': + self.root.ids.sc11.ids.ml.clear_widgets() + self.root.ids.sc11.loadAddresslist(None, 'All', '') + elif state.search_screen == 'myaddress': + self.root.ids.sc10.ids.ml.clear_widgets() + self.root.ids.sc10.init_ui() + else: + self.root.ids.sc4.ids.ml.clear_widgets() + self.root.ids.sc4.loadSent(state.association) + self.root.ids.scr_mngr.current = state.search_screen + + def closeSearchScreen(self): + self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]] + self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]] + address_label = self.current_address_label( + BMConfigParser().get(state.association, 'label'), state.association) + self.root.ids.toolbar.title = address_label + self.refreshScreen() + + def refreshScreen(self): + """Method show search button only on inbox or sent screen.""" + state.searcing_text = '' if state.search_screen == 'inbox': + try: + self.root.ids.sc1.children[3].children[1].ids.search_field.text = '' + except Exception: + self.root.ids.sc1.children[2].children[1].ids.search_field.text = '' self.root.ids.sc1.ids.ml.clear_widgets() self.root.ids.sc1.loadMessagelist(state.association) elif state.search_screen == 'addressbook': + self.root.ids.sc11.children[1].children[1].ids.search_field.text = '' self.root.ids.sc11.ids.ml.clear_widgets() self.root.ids.sc11.loadAddresslist(None, 'All', '') elif state.search_screen == 'myaddress': + try: + self.root.ids.sc10.children[3].children[1].ids.search_field.text = '' + except Exception: + self.root.ids.sc10.children[2].children[1].ids.search_field.text = '' self.root.ids.sc10.ids.ml.clear_widgets() self.root.ids.sc10.init_ui() else: + self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' self.root.ids.sc4.ids.ml.clear_widgets() self.root.ids.sc4.loadSent(state.association) - self.root.ids.scr_mngr.current = state.search_screen - - def refreshScreen(self, instance): - """Method show search button only on inbox or sent screen.""" - state.searcing_text = '' - # if instance.text == 'Sent': - # self.root.ids.sc4.ids.ml.clear_widgets() - # self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' - # self.root.ids.sc4.loadSent(state.association) - # elif instance.text == 'Inbox': - # self.root.ids.sc1.ids.ml.clear_widgets() - # try: - # self.root.ids.sc1.children[2].children[1].ids.search_field.text = '' - # except Exception: - # self.root.ids.sc1.children[1].children[1].ids.search_field.text = '' - # self.root.ids.sc1.loadMessagelist(state.association) - # elif instance.text == 'Draft': - # self.root.ids.sc16.clear_widgets() - # self.root.ids.sc16.add_widget(Draft()) - # elif instance.text == 'Trash': - # self.root.ids.sc5.clear_widgets() - # self.root.ids.sc5.add_widget(Trash()) - # elif instance.text == 'All Mails': - # self.root.ids.sc17.clear_widgets() - # self.root.ids.sc17.add_widget(Allmails()) - # elif instance.text == 'Address Book': - # self.root.ids.sc11.ids.ml.clear_widgets() - # self.root.ids.sc11.children[1].children[1].ids.search_field.text = '' - # self.root.ids.sc11.loadAddresslist(None, 'All', '') - # elif instance.text == 'My Addresses': - # self.root.ids.sc10.ids.ml.clear_widgets() - # try: - # self.root.ids.sc10.children[1].children[1].ids.search_field.text = '' - # except Exception: - # self.root.ids.sc10.children[2].children[1].ids.search_field.text = '' - # self.root.ids.sc10.init_ui() return def set_identicon(self, text): From d22c241d70f3c1fc33f0f867122ca9d514550fb0 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Wed, 6 Nov 2019 19:34:22 +0530 Subject: [PATCH 03/22] mpybit quality fix --- src/bitmessagekivy/mpybit.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index ec2a9f74..71059bd0 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -36,6 +36,7 @@ from kivy.uix.screenmanager import Screen from kivy.uix.spinner import Spinner from kivy.uix.textinput import TextInput from kivy.utils import platform + import kivy_helper_search from kivymd.button import MDIconButton from kivymd.dialog import MDDialog @@ -53,8 +54,10 @@ from kivymd.navigationdrawer import ( ) from kivymd.selectioncontrols import MDCheckbox from kivymd.theming import ThemeManager + import queues from semaphores import kivyuisignaler + import state from uikivysignaler import UIkivySignaler @@ -708,6 +711,7 @@ class Random(Screen): Clock.schedule_once(self.address_created_callback, 10) def address_created_callback(self, dt=0): + """New address created""" state.kivyapp.root.ids.sc10.children[1].active = False state.kivyapp.root.ids.sc10.init_ui() self.manager.current = 'myaddress' @@ -1260,6 +1264,7 @@ class NavigateApp(App): self.root.ids.scr_mngr.current = state.search_screen def closeSearchScreen(self): + """Function for close search screen""" self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]] self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]] address_label = self.current_address_label( @@ -2001,11 +2006,12 @@ class Spam(Screen): class LoadingPopup(Popup): - + """Load Popup""" def __init__(self, **kwargs): super(LoadingPopup, self).__init__(**kwargs) # call dismiss_popup in 2 seconds Clock.schedule_once(self.dismiss_popup, 0.5) def dismiss_popup(self, dt): - self.dismiss() \ No newline at end of file + """Dismissing popup""" + self.dismiss() From 63a7f1024401cf05b3e5ad7202a89226828c2594 Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 8 Nov 2019 17:38:26 +0530 Subject: [PATCH 04/22] worked on fixing kivy app crashing issues --- src/bitmessagekivy/kivy_helper_search.py | 2 +- src/bitmessagekivy/main.kv | 119 ++++++++++++----------- src/bitmessagekivy/mpybit.py | 118 +++++++++++++--------- src/state.py | 2 + 4 files changed, 138 insertions(+), 103 deletions(-) diff --git a/src/bitmessagekivy/kivy_helper_search.py b/src/bitmessagekivy/kivy_helper_search.py index a1fe4a99..16767fce 100644 --- a/src/bitmessagekivy/kivy_helper_search.py +++ b/src/bitmessagekivy/kivy_helper_search.py @@ -58,7 +58,7 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w sqlStatementParts.append("read = 0") if sqlStatementParts: sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts) - if folder == "sent": + if folder == "sent" or folder == "draft": sqlStatementBase += " ORDER BY lastactiontime DESC" elif folder == "inbox": sqlStatementBase += " ORDER BY received DESC" diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 63a7e009..050caf52 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -134,62 +134,64 @@ NavigationLayout: ContentNavigationDrawer: id: nav_drawer - BoxLayout: - id: box_layout - 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 - background_palette: 'Primary' - background_hue: '500' - left_action_items: [['menu', lambda x: app.root.toggle_nav_drawer()]] - right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]] + FloatLayout: + id: float_box + BoxLayout: + id: box_layout + 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 + background_palette: 'Primary' + background_hue: '500' + left_action_items: [['menu', lambda x: app.root.toggle_nav_drawer()]] + right_action_items: [['account-plus', lambda x: app.addingtoaddressbook()]] - ScreenManager: - id: scr_mngr - Inbox: - id:sc1 - Page: - id:sc2 - Create: - id:sc3 - Sent: - id:sc4 - Trash: - id:sc5 - Login: - id:sc6 - Random: - id:sc7 - Spam: - id:sc8 - Setting: - id:sc9 - MyAddress: - id:sc10 - AddressBook: - id:sc11 - Payment: - id:sc12 - NetworkStat: - id:sc13 - MailDetail: - id:sc14 - ShowQRCode: - id:sc15 - Draft: - id:sc16 - Allmails: - id:sc17 - Credits: - id:sc18 - Starred: - id:sc19 - Archieve: - id:sc20 + ScreenManager: + id: scr_mngr + Inbox: + id:sc1 + Page: + id:sc2 + Create: + id:sc3 + Sent: + id:sc4 + Trash: + id:sc5 + Login: + id:sc6 + Random: + id:sc7 + Spam: + id:sc8 + Setting: + id:sc9 + MyAddress: + id:sc10 + AddressBook: + id:sc11 + Payment: + id:sc12 + NetworkStat: + id:sc13 + MailDetail: + id:sc14 + ShowQRCode: + id:sc15 + Draft: + id:sc16 + Allmails: + id:sc17 + Credits: + id:sc18 + Starred: + id:sc19 + Archieve: + id:sc20 : name: 'inbox' @@ -201,7 +203,7 @@ NavigationLayout: MDScrollViewRefreshLayout: id: refresh_layout refresh_callback: root.refresh_callback - root_layout: root + root_layout: root.set_root_layout() MDList: id: ml Loader: @@ -266,7 +268,7 @@ NavigationLayout: MDScrollViewRefreshLayout: id: refresh_layout refresh_callback: root.refresh_callback - root_layout: root + root_layout: root.set_root_layout() MDList: id: ml ComposerButton: @@ -285,6 +287,7 @@ NavigationLayout: : name: 'create' + Loader: : name: 'credits' @@ -607,7 +610,7 @@ NavigationLayout: MDScrollViewRefreshLayout: id: refresh_layout refresh_callback: root.refresh_callback - root_layout: root + root_layout: root.set_root_layout() MDList: id: ml Loader: diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 71059bd0..f861971a 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -231,7 +231,7 @@ class Inbox(Screen): def refresh_callback(interval): """Method used for loading the inbox screen data.""" state.searcing_text = '' - self.children[3].children[1].ids.search_field.text = '' + self.children[2].children[1].ids.search_field.text = '' self.ids.ml.clear_widgets() self.loadMessagelist(state.association) self.ids.refresh_layout.refresh_done() @@ -239,6 +239,9 @@ class Inbox(Screen): Clock.schedule_once(refresh_callback, 1) + def set_root_layout(self): + return self.parent.parent.parent + class MyAddress(Screen): """MyAddress Screen uses screen to show widgets of screens.""" @@ -305,7 +308,7 @@ class MyAddress(Screen): """Method used for loading the myaddress screen data.""" state.searcing_text = '' state.kivyapp.root.ids.sc10.children[2].active = False - self.children[3].children[1].ids.search_field.text = '' + self.children[2].children[1].ids.search_field.text = '' self.ids.ml.clear_widgets() self.init_ui() self.ids.refresh_layout.refresh_done() @@ -322,6 +325,9 @@ class MyAddress(Screen): return True return False + def set_root_layout(self): + return self.manager.parent.parent + class AddressBook(Screen): """AddressBook Screen uses screen to show widgets of screens.""" @@ -466,10 +472,10 @@ class DropDownWidget(BoxLayout): sendMessageToPeople = True if sendMessageToPeople: if toAddress != '' and subject and message: - # navApp.root.ids.sc1.children[1].active = True from addresses import decodeAddress status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress) if status == 'success': + navApp.root.ids.sc3.children[0].active = True if state.detailPageType == 'draft' and state.send_draft_mail: sqlExecute( "UPDATE sent SET toaddress = ?" @@ -521,22 +527,23 @@ class DropDownWidget(BoxLayout): BMConfigParser().getint( 'bitmessagesettings', 'ttl')) state.check_sent_acc = fromAddress + # state.msg_counter_objs = self.parent.parent.parent.parent\ + # .parent.parent.children[0].children[2].children[0].ids state.msg_counter_objs = self.parent.parent.parent.parent\ - .parent.parent.children[0].children[2].children[0].ids + .parent.parent.children[2].children[0].ids + self.parent.parent.screens[0].ids.ml.clear_widgets() + self.parent.parent.screens[0].loadMessagelist(state.association) self.parent.parent.screens[3].ids.ml.clear_widgets() self.parent.parent.screens[3].loadSent(state.association) self.parent.parent.screens[16].clear_widgets() self.parent.parent.screens[16].add_widget(Allmails()) + toast('sending...') + Clock.schedule_once(self.callback_for_msgsend, 6) toLabel = '' - queues.workerQueue.put(('sendmessage', toAddress)) print "sqlExecute successfully #######################" - self.parent.parent.current = 'inbox' - # navApp.root.ids.sc1.children[1].active = False state.in_composer = True - navApp.back_press() - toast('send') - return None + return else: msg = 'Enter a valid recipients address' elif not toAddress: @@ -545,6 +552,12 @@ class DropDownWidget(BoxLayout): msg = 'Please fill the form' self.address_error_message(msg) + def callback_for_msgsend(self, dt=0): + state.kivyapp.root.ids.sc3.children[0].active = False + state.in_sent_method = True + state.kivyapp.back_press() + toast('sent') + # pylint: disable=attribute-defined-outside-init def address_error_message(self, msg): """Show Error Message.""" @@ -703,16 +716,16 @@ class Random(Screen): nonceTrialsPerByte, payloadLengthExtraBytes)) self.ids.label.text = '' - self.parent.parent.parent.parent.ids.toolbar.opacity = 1 - self.parent.parent.parent.parent.ids.toolbar.disabled = False - self.parent.parent.parent.parent.ids.sc10.ids.ml.clear_widgets() - self.parent.parent.parent.parent.ids.sc10.children[1].active = True + self.parent.parent.children[1].opacity = 1 + self.parent.parent.children[1].disabled = False + state.kivyapp.root.ids.sc10.children[1].active = True self.manager.current = 'myaddress' - Clock.schedule_once(self.address_created_callback, 10) + Clock.schedule_once(self.address_created_callback, 6) def address_created_callback(self, dt=0): """New address created""" state.kivyapp.root.ids.sc10.children[1].active = False + state.kivyapp.root.ids.sc10.ids.ml.clear_widgets() state.kivyapp.root.ids.sc10.init_ui() self.manager.current = 'myaddress' toast('New address created') @@ -1138,13 +1151,10 @@ class NavigateApp(App): if state.detailPageType == 'inbox' else 'draft' self.back_press() elif self.root.ids.scr_mngr.current == "create": - composer_objs = self.root - from_addr = str(self.root.ids.sc3.children[0].ids.ti.text) - to_addr = str(self.root.ids.sc3.children[0].ids.txt_input.text) - if from_addr and to_addr and state.detailPageType != 'draft': - Draft().draft_msg(composer_objs) + self.save_draft() + self.set_common_header() + state.in_composer = False self.root.ids.scr_mngr.current = 'inbox' - self.back_press() elif self.root.ids.scr_mngr.current == "showqrcode": self.root.ids.scr_mngr.current = 'myaddress' elif self.root.ids.scr_mngr.current == "random": @@ -1169,6 +1179,14 @@ class NavigateApp(App): self.root.ids.sc4.loadSent(state.association) self.root.ids.scr_mngr.current = state.search_screen + def save_draft(self): + 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' and not state.in_sent_method: + Draft().draft_msg(composer_objs) + return + def reset(self, *args): """Method used to set transition direction.""" self.root.ids.scr_mngr.transition.direction = 'left' @@ -1185,26 +1203,32 @@ class NavigateApp(App): """If slow down the nwe will make new composer edit screen.""" self.set_navbar_for_composer() # self.root.ids.search_bar.clear_widgets() - composer_obj = self.root.ids.sc3.children[0].ids + composer_obj = self.root.ids.sc3.children[1].ids composer_obj.ti.text = '' composer_obj.btn.text = 'Select' composer_obj.txt_input.text = '' composer_obj.subject.text = '' composer_obj.body.text = '' state.in_composer = True + state.in_sent_method = False def set_navbar_for_composer(self): """This method is used for clearing toolbar data when composer open""" self.root.ids.toolbar.left_action_items = [ ['arrow-left', lambda x: self.back_press()]] self.root.ids.toolbar.right_action_items = [ - ['refresh', lambda x: self.root.ids.sc3.children[0].reset_composer()], - ['send', lambda x: self.root.ids.sc3.children[0].send(self)]] + ['refresh', lambda x: self.root.ids.sc3.children[1].reset_composer()], + ['send', lambda x: self.root.ids.sc3.children[1].send(self)]] + + def set_common_header(self): + self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]] + self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]] + return def back_press(self): """Method used for going back from composer to previous page.""" - self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]] - self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]] + self.save_draft() + self.set_common_header() self.root.ids.scr_mngr.current = 'inbox' \ if state.in_composer else 'allmails'\ if state.is_allmail else state.detailPageType\ @@ -1265,8 +1289,7 @@ class NavigateApp(App): def closeSearchScreen(self): """Function for close search screen""" - self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]] - self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]] + self.set_common_header() address_label = self.current_address_label( BMConfigParser().get(state.association, 'label'), state.association) self.root.ids.toolbar.title = address_label @@ -1538,13 +1561,13 @@ class MailDetail(Screen): data = sqlQuery( "select toaddress, fromaddress, subject, message from inbox where" " msgid = ?;", str(state.mail_id)) - composer_obj = self.parent.screens[2].children[0].ids + composer_obj = self.parent.screens[2].children[1].ids composer_obj.ti.text = data[0][0] composer_obj.btn.text = data[0][0] composer_obj.txt_input.text = data[0][1] composer_obj.subject.text = data[0][2] composer_obj.body.text = '' - state.kivyapp.root.ids.sc3.children[0].ids.rv.data = '' + state.kivyapp.root.ids.sc3.children[1].ids.rv.data = '' self.parent.current = 'create' state.kivyapp.set_navbar_for_composer() @@ -1555,11 +1578,11 @@ class MailDetail(Screen): def write_msg(self, navApp): """Method used to write on draft mail.""" state.send_draft_mail = state.mail_id - composer_ids = self.parent.parent.parent.parent.ids.sc3.children[0].ids + composer_ids = self.parent.parent.parent.parent.parent.ids.sc3.children[1].ids composer_ids.ti.text = state.write_msg['from_addr'] composer_ids.btn.text = state.write_msg['from_addr'] composer_ids.txt_input.text = state.write_msg['to_addr'] - composer_ids.subject.text = state.write_msg['subject'] + composer_ids.subject.text = state.write_msg['subject'] if state.write_msg['subject'] != '(no subject)' else '' composer_ids.body.text = state.write_msg['message'] self.parent.current = 'create' navApp.set_navbar_for_composer() @@ -1593,12 +1616,13 @@ 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 - window_obj.sc3.children[0].ids.ti.text = self.address - window_obj.sc3.children[0].ids.btn.text = self.address - window_obj.sc3.children[0].ids.txt_input.text = '' - window_obj.sc3.children[0].ids.subject.text = '' - window_obj.sc3.children[0].ids.body.text = '' + 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 = '' + window_obj.sc3.children[1].ids.subject.text = '' + window_obj.sc3.children[1].ids.body.text = '' window_obj.scr_mngr.current = 'create' self.dismiss() @@ -1637,12 +1661,13 @@ 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 - window_obj.sc3.children[0].ids.txt_input.text = self.address - window_obj.sc3.children[0].ids.ti.text = '' - window_obj.sc3.children[0].ids.btn.text = 'Select' - window_obj.sc3.children[0].ids.subject.text = '' - window_obj.sc3.children[0].ids.body.text = '' + 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' + window_obj.sc3.children[1].ids.subject.text = '' + window_obj.sc3.children[1].ids.body.text = '' window_obj.scr_mngr.current = 'create' self.dismiss() @@ -1776,8 +1801,7 @@ class Draft(Screen): def draft_msg(src_object): """Method used for saving draft mails.""" # pylint: disable=too-many-locals - composer_object = src_object.children[1].children[0].children[ - 0].children[0].children[0].ids + composer_object = state.kivyapp.root.ids.sc3.children[1].ids fromAddress = str(composer_object.ti.text) toAddress = str(composer_object.txt_input.text) subject = str(composer_object.subject.text) @@ -1974,6 +1998,12 @@ class Allmails(Screen): self.tick = 0 Clock.schedule_once(refresh_callback, 1) + def set_root_layout(self): + try: + return self.manager.parent.parent + except Exception as e: + return state.kivyapp.root.ids.float_box + def avatarImageFirstLetter(letter_string): """This method is used to the first letter for the avatar image""" diff --git a/src/state.py b/src/state.py index 4baf5614..1a55b248 100644 --- a/src/state.py +++ b/src/state.py @@ -106,3 +106,5 @@ in_composer = False write_msg = {} availabe_credit = 0 + +in_sent_method = False \ No newline at end of file From 895a705657aee3cc88edd64b7b25d4aa1dbee0cd Mon Sep 17 00:00:00 2001 From: navjot Date: Tue, 19 Nov 2019 21:28:30 +0530 Subject: [PATCH 05/22] worked on infinite scroller functionality --- src/bitmessagekivy/main.kv | 10 + src/bitmessagekivy/mpybit.py | 854 +++++++++++++++++++++++------------ src/state.py | 4 +- 3 files changed, 570 insertions(+), 298 deletions(-) diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 050caf52..5547de61 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -217,14 +217,17 @@ NavigationLayout: BoxLayout: orientation:'vertical' ScrollView: + id: scroll_y do_scroll_x: False MDList: id: ml + Loader: ComposerButton: : name: 'trash' ScrollView: + id: scroll_y do_scroll_x: False MDList: id: ml @@ -233,6 +236,7 @@ NavigationLayout: : name: 'draft' ScrollView: + id: scroll_y do_scroll_x: False MDList: id: ml @@ -510,6 +514,7 @@ NavigationLayout: hint_text: "Label" required: True helper_text_mode: "on_error" + on_text: root.add_validation(self) BoxLayout: AnchorLayout: MDRaisedButton: @@ -624,9 +629,11 @@ NavigationLayout: BoxLayout: orientation:'vertical' ScrollView: + id: scroll_y do_scroll_x: False MDList: id: ml + Loader: ComposerButton: : @@ -799,6 +806,7 @@ NavigationLayout: hint_text: "Label" required: True helper_text_mode: "on_error" + on_text: root.checkLabel_valid(self) MDTextField: id: address hint_text: "Address" @@ -1118,6 +1126,7 @@ NavigationLayout: theme_text_color: 'Primary' required: True helper_text_mode: "on_error" + on_text: root.checkLabel_valid(self) MDLabel: font_style: 'Title' theme_text_color: 'Primary' @@ -1125,6 +1134,7 @@ NavigationLayout: font_size: '17sp' halign: 'left' MDLabel: + id: address font_style: 'Subhead' theme_text_color: 'Primary' text: root.address diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index f861971a..fdcf2da6 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -83,6 +83,8 @@ class Navigatorss(MDNavigationDrawer): class Inbox(Screen): """Inbox Screen uses screen to show widgets of screens.""" + queryreturn = ListProperty() + has_refreshed = True def __init__(self, *args, **kwargs): """Method Parsing the address.""" @@ -110,15 +112,13 @@ class Inbox(Screen): what = state.searcing_text xAddress = 'toaddress' data = [] - queryreturn = kivy_helper_search.search_sql( + self.queryreturn = kivy_helper_search.search_sql( xAddress, account, "inbox", where, what, False) - if queryreturn: + if self.queryreturn: src_mng_obj = state.kivyapp.root.children[2].children[0].ids - src_mng_obj.inbox_cnt.badge_text = str(len(queryreturn)) - state.inbox_count = str(len(queryreturn)) - state.kivyapp.root.ids.sc17.clear_widgets() - state.kivyapp.root.ids.sc17.add_widget(Allmails()) - for mail in queryreturn: + src_mng_obj.inbox_cnt.badge_text = str(len(self.queryreturn)) + state.inbox_count = str(len(self.queryreturn)) + for mail in self.queryreturn[:20]: third_text = mail[3].replace('\n', ' ') data.append({ 'text': mail[4].strip(), @@ -126,37 +126,9 @@ class Inbox(Screen): mail[5]) >= 50 else ( mail[5] + ',' + mail[3].replace('\n', ''))[0:50] + '........', 'msgid': mail[1]}) - for item in data: - meny = TwoLineAvatarIconListItem( - text=item['text'], - secondary_text=item['secondary_text'], - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) - meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - avatarImageFirstLetter(item['secondary_text'].strip())))) - meny.bind(on_press=partial( - self.inbox_detail, item['msgid'])) - carousel = Carousel(direction='right') - carousel.height = meny.height - 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, item['msgid'])) - carousel.add_widget(del_btn) - carousel.add_widget(meny) - ach_btn = Button(text='Achieve') - ach_btn.background_color = (0, 1, 0, 1) - ach_btn.bind(on_press=partial( - self.archive, item['msgid'])) - carousel.add_widget(ach_btn) - carousel.index = 1 - self.ids.ml.add_widget(carousel) + self.has_refreshed = True + self.set_mdList(data) + self.children[2].children[0].children[0].bind(scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -169,6 +141,64 @@ class Inbox(Screen): valign='top') self.ids.ml.add_widget(content) + def set_mdList(self, data): + """This method is used to create the mdList""" + for item in data: + meny = TwoLineAvatarIconListItem( + text=item['text'], + secondary_text=item['secondary_text'], + theme_text_color='Custom', + text_color=NavigateApp().theme_cls.primary_color) + meny.add_widget(AvatarSampleWidget( + source='./images/text_images/{}.png'.format( + avatarImageFirstLetter(item['secondary_text'].strip())))) + meny.bind(on_press=partial( + self.inbox_detail, item['msgid'])) + carousel = Carousel(direction='right') + carousel.height = meny.height + 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, item['msgid'])) + carousel.add_widget(del_btn) + carousel.add_widget(meny) + ach_btn = Button(text='Achieve') + ach_btn.background_color = (0, 1, 0, 1) + ach_btn.bind(on_press=partial( + self.archive, item['msgid'])) + carousel.add_widget(ach_btn) + carousel.index = 1 + self.ids.ml.add_widget(carousel) + + def check_scroll_y(self, instance, somethingelse): + """This method is used to load data on scroll""" + if self.children[2].children[0].children[0].scroll_y <= -0.0 and self.has_refreshed: + self.children[2].children[0].children[0].scroll_y = 0.06 + total_message = len(self.ids.ml.children) + if total_message != len(self.queryreturn): + self.update_inbox_screen_on_scroll(total_message) + self.has_refreshed = True if total_message != len(self.queryreturn) else False + else: + pass + + def update_inbox_screen_on_scroll(self, total_message): + """This method is used to load more data on scroll down""" + data = [] + for mail in self.queryreturn[total_message:total_message + 5]: + third_text = mail[3].replace('\n', ' ') + data.append({ + 'text': mail[4].strip(), + 'secondary_text': mail[5][:50] + '........' if len( + mail[5]) >= 50 else ( + mail[5] + ',' + mail[3].replace('\n', ''))[0:50] + '........', + 'msgid': mail[1]}) + self.set_mdList(data) + def inbox_detail(self, msg_id, *args): """Load inbox page details.""" state.detailPageType = 'inbox' @@ -234,6 +264,7 @@ class Inbox(Screen): self.children[2].children[1].ids.search_field.text = '' self.ids.ml.clear_widgets() self.loadMessagelist(state.association) + self.has_refreshed = True self.ids.refresh_layout.refresh_done() self.tick = 0 @@ -245,6 +276,8 @@ class Inbox(Screen): class MyAddress(Screen): """MyAddress Screen uses screen to show widgets of screens.""" + addresses_list = ListProperty() + has_refreshed = True def __init__(self, *args, **kwargs): """Clock Schdule for method inbox accounts.""" @@ -254,29 +287,17 @@ class MyAddress(Screen): def init_ui(self, dt=0): """Clock Schdule for method inbox accounts.""" # pylint: disable=unnecessary-lambda, deprecated-lambda - addresses_list = state.kivyapp.variable_1 + self.addresses_list = state.kivyapp.variable_1 if state.searcing_text: filtered_list = filter( lambda addr: self.filter_address( addr), BMConfigParser().addresses()) - addresses_list = filtered_list - if addresses_list: - data = [] - for address in addresses_list: - data.append({ - 'text': BMConfigParser().get(address, 'label'), - 'secondary_text': address}) - for item in data: - meny = TwoLineAvatarIconListItem( - text=item['text'], - secondary_text=item['secondary_text'], - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) - meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format(avatarImageFirstLetter(item['text'].strip())))) - meny.bind(on_press=partial( - self.myadd_detail, item['secondary_text'], item['text'])) - self.ids.ml.add_widget(meny) + self.addresses_list = filtered_list + self.addresses_list = [obj for obj in reversed(self.addresses_list)] + if self.addresses_list: + self.has_refreshed = True + self.set_mdList(0, 15) + self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -294,6 +315,40 @@ class MyAddress(Screen): except Exception: pass + def set_mdList(self, first_index, last_index): + """This method is used to create the mdlist""" + data = [] + for address in self.addresses_list[first_index:last_index]: + data.append({ + 'text': BMConfigParser().get(address, 'label'), + 'secondary_text': address}) + for item in data: + meny = TwoLineAvatarIconListItem( + text=item['text'], + secondary_text=item['secondary_text'], + theme_text_color='Custom', + text_color=NavigateApp().theme_cls.primary_color) + meny.add_widget(AvatarSampleWidget( + source='./images/text_images/{}.png'.format(avatarImageFirstLetter(item['text'].strip())))) + meny.bind(on_press=partial( + self.myadd_detail, item['secondary_text'], item['text'])) + self.ids.ml.add_widget(meny) + + def check_scroll_y(self, instance, somethingelse): + """This method is used to load data on scroll""" + if self.ids.refresh_layout.scroll_y <= -0.0 and self.has_refreshed: + self.ids.refresh_layout.scroll_y = 0.06 + my_addresses = len(self.ids.ml.children) + if my_addresses != len(self.addresses_list): + self.update_addressBook_on_scroll(my_addresses) + self.has_refreshed = True if my_addresses != len(self.addresses_list) else False + else: + pass + + def update_addressBook_on_scroll(self, my_addresses): + """This method is used to load more data on scroll down""" + self.set_mdList(my_addresses,my_addresses + 20) + @staticmethod def myadd_detail(fromaddress, label, *args): """Myaddress Details.""" @@ -309,6 +364,7 @@ class MyAddress(Screen): state.searcing_text = '' state.kivyapp.root.ids.sc10.children[2].active = False self.children[2].children[1].ids.search_field.text = '' + self.has_refreshed = True self.ids.ml.clear_widgets() self.init_ui() self.ids.refresh_layout.refresh_done() @@ -331,6 +387,8 @@ class MyAddress(Screen): class AddressBook(Screen): """AddressBook Screen uses screen to show widgets of screens.""" + queryreturn = ListProperty() + has_refreshed = True def __init__(self, *args, **kwargs): """Getting AddressBook Details.""" @@ -348,33 +406,13 @@ class AddressBook(Screen): where = ['label', 'address'] what = state.searcing_text xAddress = '' - queryreturn = kivy_helper_search.search_sql( + self.queryreturn = kivy_helper_search.search_sql( xAddress, account, "addressbook", where, what, False) - if queryreturn: - for item in queryreturn: - 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(avatarImageFirstLetter(item[0].strip())))) - meny.bind(on_press=partial( - self.addBook_detail, item[1], item[0])) - carousel = Carousel(direction='right') - carousel.height = meny.height - 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) + self.queryreturn = [obj for obj in reversed(self.queryreturn)] + if self.queryreturn: + self.has_refreshed = True + self.set_mdList(0,20) + self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -387,6 +425,48 @@ class AddressBook(Screen): valign='top') self.ids.ml.add_widget(content) + def set_mdList(self, start_index, end_index): + """This method is used to create the mdList""" + for item in self.queryreturn[start_index:end_index]: + 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(avatarImageFirstLetter(item[0].strip())))) + meny.bind(on_press=partial( + self.addBook_detail, item[1], item[0])) + carousel = Carousel(direction='right') + carousel.height = meny.height + 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) + + def check_scroll_y(self, instance, somethingelse): + """This method is used to load data on scroll""" + if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: + self.ids.scroll_y.scroll_y = 0.06 + exist_addresses = len(self.ids.ml.children) + if exist_addresses != len(self.queryreturn): + self.update_addressBook_on_scroll(exist_addresses) + self.has_refreshed = True if exist_addresses != len(self.queryreturn) else False + else: + pass + + def update_addressBook_on_scroll(self, exist_addresses): + """This method is used to load more data on scroll down""" + self.set_mdList(exist_addresses,exist_addresses + 20) + @staticmethod def refreshs(*args): """Refresh the Widget.""" @@ -531,14 +611,13 @@ class DropDownWidget(BoxLayout): # .parent.parent.children[0].children[2].children[0].ids state.msg_counter_objs = self.parent.parent.parent.parent\ .parent.parent.children[2].children[0].ids - self.parent.parent.screens[0].ids.ml.clear_widgets() - self.parent.parent.screens[0].loadMessagelist(state.association) - self.parent.parent.screens[3].ids.ml.clear_widgets() - self.parent.parent.screens[3].loadSent(state.association) + # self.parent.parent.screens[0].ids.ml.clear_widgets() + # self.parent.parent.screens[0].loadMessagelist(state.association) + self.parent.parent.screens[3].update_sent_messagelist() self.parent.parent.screens[16].clear_widgets() self.parent.parent.screens[16].add_widget(Allmails()) - toast('sending...') - Clock.schedule_once(self.callback_for_msgsend, 6) + # toast('sending...') + Clock.schedule_once(self.callback_for_msgsend, 3) toLabel = '' queues.workerQueue.put(('sendmessage', toAddress)) print "sqlExecute successfully #######################" @@ -702,12 +781,14 @@ class Random(Screen): def generateaddress(self, navApp): """Method for Address Generator.""" + entered_label = str(self.ids.label.text).strip() streamNumberForAddress = 1 label = self.ids.label.text eighteenByteRipe = False nonceTrialsPerByte = 1000 payloadLengthExtraBytes = 1000 - if str(self.ids.label.text).strip(): + lables = [BMConfigParser().get(obj, 'label') for obj in BMConfigParser().addresses()] + if entered_label and entered_label not in lables: toast('Address Creating...') queues.addressGeneratorQueue.put(( 'createRandomAddress', @@ -730,9 +811,25 @@ class Random(Screen): self.manager.current = 'myaddress' toast('New address created') + def add_validation(self, instance): + """Checking validation at address creation time.""" + entered_label = str(instance.text.strip()) + lables = [BMConfigParser().get(obj, 'label') for obj in BMConfigParser().addresses()] + if entered_label in lables: + self.ids.label.error = True + self.ids.label.helper_text = 'Label name is already exist' + elif entered_label: + self.ids.label.error = False + else: + self.ids.label.error = False + self.ids.label.helper_text = 'This field is required' + class Sent(Screen): """Sent Screen uses screen to show widgets of screens.""" + queryreturn = ListProperty() + has_refreshed = True + def __init__(self, *args, **kwargs): """Association with the screen.""" super(Sent, self).__init__(*args, **kwargs) @@ -758,57 +855,27 @@ class Sent(Screen): what = state.searcing_text xAddress = 'fromaddress' data = [] - queryreturn = kivy_helper_search.search_sql( + self.queryreturn = kivy_helper_search.search_sql( xAddress, account, "sent", where, what, False) if state.msg_counter_objs and state.association == state.check_sent_acc: - state.msg_counter_objs.send_cnt.badge_text = str(len(queryreturn)) + state.msg_counter_objs.send_cnt.badge_text = str(len(self.queryreturn)) state.sent_count = str(int(state.sent_count) + 1) state.all_count = str(int(state.all_count) + 1) state.msg_counter_objs.allmail_cnt.badge_text = state.all_count state.check_sent_acc = None - if queryreturn: - src_mng_obj = state.kivyapp.root.children[2].children[0].ids - src_mng_obj.send_cnt.badge_text = str(len(queryreturn)) - state.sent_count = str(len(queryreturn)) - for mail in queryreturn: + if self.queryreturn: + self.set_sentCount(len(self.queryreturn)) + for mail in self.queryreturn[0:20]: 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] + '........', 'ackdata': mail[5]}) - for item in data: - meny = TwoLineAvatarIconListItem( - text=item['text'], - secondary_text=item['secondary_text'], - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) - meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - avatarImageFirstLetter(item['secondary_text'].strip())))) - meny.bind(on_press=partial( - self.sent_detail, item['ackdata'])) - carousel = Carousel(direction='right') - carousel.height = meny.height - 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, item['ackdata'])) - carousel.add_widget(del_btn) - carousel.add_widget(meny) - ach_btn = Button(text='Achieve') - ach_btn.background_color = (0, 1, 0, 1) - ach_btn.bind(on_press=partial( - self.archive, item['ackdata'])) - carousel.add_widget(ach_btn) - carousel.index = 1 - self.ids.ml.add_widget(carousel) + self.set_mdlist(data, 0) + self.has_refreshed = True + self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -821,6 +888,90 @@ class Sent(Screen): valign='top') self.ids.ml.add_widget(content) + def set_mdlist(self, data, set_index): + """This method is used to create the mdList""" + for item in data: + meny = TwoLineAvatarIconListItem( + text=item['text'], + secondary_text=item['secondary_text'], + theme_text_color='Custom', + text_color=NavigateApp().theme_cls.primary_color) + meny.add_widget(AvatarSampleWidget( + source='./images/text_images/{}.png'.format( + avatarImageFirstLetter(item['secondary_text'].strip())))) + meny.bind(on_press=partial( + self.sent_detail, item['ackdata'])) + carousel = Carousel(direction='right') + carousel.height = meny.height + 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, item['ackdata'])) + carousel.add_widget(del_btn) + carousel.add_widget(meny) + ach_btn = Button(text='Achieve') + ach_btn.background_color = (0, 1, 0, 1) + ach_btn.bind(on_press=partial( + self.archive, item['ackdata'])) + carousel.add_widget(ach_btn) + carousel.index = 1 + self.ids.ml.add_widget(carousel, index=set_index) + + def update_sent_messagelist(self): + """This method is used to update screen when new mail is sent""" + if len(self.ids.ml.children) <3: + self.ids.ml.clear_widgets() + self.loadSent(state.association) + else: + account = state.association + data = [] + self.queryreturn = kivy_helper_search.search_sql( + 'fromaddress', account, "sent", '', '', False) + total_sent = len(self.queryreturn) + self.set_sentCount(total_sent) + for mail in self.queryreturn[:1]: + 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] + '........', + 'ackdata': mail[5]}) + self.set_mdlist(data, total_sent-1) + + def check_scroll_y(self, instance, somethingelse): + """This method is used to load data on scroll""" + if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: + self.ids.scroll_y.scroll_y = 0.06 + total_sent_msg = len(self.ids.ml.children) + if total_sent_msg != len(self.queryreturn): + self.update_sent_screen_on_scroll(total_sent_msg) + self.has_refreshed = True if total_sent_msg != len(self.queryreturn) else False + else: + pass + + def update_sent_screen_on_scroll(self, total_sent_msg): + """This method is used to load more data on scroll down""" + data = [] + for mail in self.queryreturn[total_sent_msg:total_sent_msg + 5]: + 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] + '........', + 'ackdata': mail[5]}) + self.set_mdlist(data, 0) + + def set_sentCount(self, total_sent): + """Set the total no. of sent message count""" + src_mng_obj = state.kivyapp.root.children[2].children[0].ids + src_mng_obj.send_cnt.badge_text = str(total_sent) + state.sent_count = str(total_sent) + def sent_detail(self, ackdata, *args): """Load sent mail details.""" state.detailPageType = 'sent' @@ -882,6 +1033,8 @@ class Sent(Screen): class Trash(Screen): """Trash Screen uses screen to show widgets of screens.""" + trash_messages = ListProperty() + has_refreshed = True def __init__(self, *args, **kwargs): """Trash method, delete sent message and add in Trash.""" @@ -893,47 +1046,17 @@ class Trash(Screen): if state.association == '': if BMConfigParser().addresses(): state.association = BMConfigParser().addresses()[0] - inbox = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder, received from" - " inbox WHERE folder = 'trash' and toaddress = '{}';".format( - state.association)) - sent = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder, lastactiontime from" - " sent WHERE folder = 'trash' and fromaddress = '{}';".format( - state.association)) - trash_data = inbox + sent - - if trash_data: + self.trash_messages = sqlQuery( + "SELECT toaddress, fromaddress, subject, message, folder, ackdata As id, DATE(lastactiontime)" + " As actionTime FROM sent WHERE folder = 'trash' UNION" + " SELECT toaddress, fromaddress, subject, message, folder, msgid As id, DATE(received) As" + " actionTime FROM inbox WHERE folder = 'trash' ORDER BY actionTime DESC") + if self.trash_messages: src_mng_obj = state.kivyapp.root.children[2].children[0].ids - src_mng_obj.trash_cnt.badge_text = str(len(trash_data)) - state.trash_count = str(len(trash_data)) - for item in trash_data: - meny = TwoLineAvatarIconListItem( - text=item[1], - secondary_text=item[2][:50] + '........' if len( - item[2]) >= 50 else ( - item[2] + ',' + item[3].replace('\n', ''))[0:50] + '........', - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) - 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)) - carousel = Carousel(direction='right') - carousel.height = meny.height - 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_permanently, item[5])) - carousel.add_widget(del_btn) - carousel.add_widget(meny) - carousel.index = 1 - self.ids.ml.add_widget(carousel) + src_mng_obj.trash_cnt.badge_text = str(len(self.trash_messages)) + state.trash_count = str(len(self.trash_messages)) + self.set_mdList(0,20) + self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -945,6 +1068,51 @@ class Trash(Screen): valign='top') self.ids.ml.add_widget(content) + def set_mdList(self, first_index, last_index): + """This method is used to create the mdlist""" + for item in self.trash_messages[first_index:last_index]: + meny = TwoLineAvatarIconListItem( + text=item[1], + secondary_text=item[2][:50] + '........' if len( + item[2]) >= 50 else ( + item[2] + ',' + item[3].replace('\n', ''))[0:50] + '........', + theme_text_color='Custom', + text_color=NavigateApp().theme_cls.primary_color) + 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)) + carousel = Carousel(direction='right') + carousel.height = meny.height + 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_permanently, item[5])) + carousel.add_widget(del_btn) + carousel.add_widget(meny) + carousel.index = 1 + self.ids.ml.add_widget(carousel) + + def check_scroll_y(self, instance, somethingelse): + """This method is used to load data on scroll""" + if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: + self.ids.scroll_y.scroll_y = 0.06 + total_trash_msg = len(self.ids.ml.children) + if total_trash_msg != len(self.trash_messages): + self.update_trash_screen_on_scroll(total_trash_msg) + self.has_refreshed = True if total_trash_msg != len(self.trash_messages) else False + else: + pass + + def update_trash_screen_on_scroll(self, total_trash_msg): + """This method is used to load more data on scroll down""" + self.set_mdList(total_trash_msg,total_trash_msg+5) + def delete_permanently(self, data_index, instance, *args): """Deleting trash mail permanently.""" pass @@ -1051,7 +1219,7 @@ class NavigateApp(App): self.root.ids.sc1.loadMessagelist(state.association) self.root.ids.sc4.ids.ml.clear_widgets() - self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' + self.root.ids.sc4.children[2].children[1].ids.search_field.text = '' self.root.ids.sc4.loadSent(state.association) self.root.ids.sc16.clear_widgets() @@ -1145,7 +1313,9 @@ class NavigateApp(App): def on_key(self, window, key, *args): """Method is used for going on previous screen.""" if key == 27: - if self.root.ids.scr_mngr.current == "mailDetail": + if state.in_search_mode and self.root.ids.scr_mngr.current != "mailDetail": + self.closeSearchScreen() + elif self.root.ids.scr_mngr.current == "mailDetail": self.root.ids.scr_mngr.current = 'sent'\ if state.detailPageType == 'sent' else 'inbox' \ if state.detailPageType == 'inbox' else 'draft' @@ -1164,20 +1334,39 @@ class NavigateApp(App): self.root.ids.scr_mngr.transition.direction = 'right' self.root.ids.scr_mngr.transition.bind(on_complete=self.reset) return True - elif key == 13 and platform == 'android': - if state.search_screen == 'inbox': - self.root.ids.sc1.ids.ml.clear_widgets() - self.root.ids.sc1.loadMessagelist(state.association) + elif key == 13: + if state.search_screen == 'inbox' and state.searcing_text: + self.root.ids.sc1.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) elif state.search_screen == 'addressbook': - self.root.ids.sc11.ids.ml.clear_widgets() - self.root.ids.sc11.loadAddresslist(None, 'All', '') + self.root.ids.sc11.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) elif state.search_screen == 'myaddress': - self.root.ids.sc10.ids.ml.clear_widgets() - self.root.ids.sc10.init_ui() - else: - self.root.ids.sc4.ids.ml.clear_widgets() - self.root.ids.sc4.loadSent(state.association) - self.root.ids.scr_mngr.current = state.search_screen + self.root.ids.sc10.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) + elif state.search_screen == 'sent': + self.root.ids.sc4.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) + + def search_callback(self, dt=0): + """This method is used to show data after loader is loaded""" + if state.search_screen == 'inbox': + self.root.ids.sc1.ids.ml.clear_widgets() + self.root.ids.sc1.loadMessagelist(state.association) + self.root.ids.sc1.children[1].active = False + elif state.search_screen == 'addressbook': + self.root.ids.sc11.ids.ml.clear_widgets() + self.root.ids.sc11.loadAddresslist(None, 'All', '') + self.root.ids.sc11.children[1].active = False + elif state.search_screen == 'myaddress': + self.root.ids.sc10.ids.ml.clear_widgets() + self.root.ids.sc10.init_ui() + self.root.ids.sc10.children[1].active = False + else: + self.root.ids.sc4.ids.ml.clear_widgets() + self.root.ids.sc4.loadSent(state.association) + self.root.ids.sc4.children[1].active = False + self.root.ids.scr_mngr.current = state.search_screen def save_draft(self): composer_objs = self.root @@ -1202,7 +1391,6 @@ class NavigateApp(App): def clear_composer(self): """If slow down the nwe will make new composer edit screen.""" self.set_navbar_for_composer() - # self.root.ids.search_bar.clear_widgets() composer_obj = self.root.ids.sc3.children[1].ids composer_obj.ti.text = '' composer_obj.btn.text = 'Select' @@ -1228,7 +1416,13 @@ class NavigateApp(App): def back_press(self): """Method used for going back from composer to previous page.""" self.save_draft() - self.set_common_header() + if self.root.ids.scr_mngr.current == 'mailDetail' and state.in_search_mode: + toolbar_obj = self.root.ids.toolbar + toolbar_obj.left_action_items = [['arrow-left', lambda x: self.closeSearchScreen()]] + toolbar_obj.right_action_items = [] + self.root.ids.toolbar.title = '' + else: + self.set_common_header() self.root.ids.scr_mngr.current = 'inbox' \ if state.in_composer else 'allmails'\ if state.is_allmail else state.detailPageType\ @@ -1269,23 +1463,10 @@ class NavigateApp(App): state.searcing_text = str(instance.text).strip() if instance.focus and state.searcing_text: toolbar_obj = self.root.ids.toolbar - toolbar_obj.left_action_items = [['close', lambda x: self.closeSearchScreen()]] + toolbar_obj.left_action_items = [['arrow-left', lambda x: self.closeSearchScreen()]] toolbar_obj.right_action_items = [] self.root.ids.toolbar.title = '' - if platform == 'linux': - if state.search_screen == 'inbox': - self.root.ids.sc1.ids.ml.clear_widgets() - self.root.ids.sc1.loadMessagelist(state.association) - elif state.search_screen == 'addressbook': - self.root.ids.sc11.ids.ml.clear_widgets() - self.root.ids.sc11.loadAddresslist(None, 'All', '') - elif state.search_screen == 'myaddress': - self.root.ids.sc10.ids.ml.clear_widgets() - self.root.ids.sc10.init_ui() - else: - self.root.ids.sc4.ids.ml.clear_widgets() - self.root.ids.sc4.loadSent(state.association) - self.root.ids.scr_mngr.current = state.search_screen + state.in_search_mode = True def closeSearchScreen(self): """Function for close search screen""" @@ -1293,7 +1474,9 @@ class NavigateApp(App): address_label = self.current_address_label( BMConfigParser().get(state.association, 'label'), state.association) self.root.ids.toolbar.title = address_label + state.searcing_text = '' self.refreshScreen() + state.in_search_mode = False def refreshScreen(self): """Method show search button only on inbox or sent screen.""" @@ -1303,23 +1486,23 @@ class NavigateApp(App): self.root.ids.sc1.children[3].children[1].ids.search_field.text = '' except Exception: self.root.ids.sc1.children[2].children[1].ids.search_field.text = '' - self.root.ids.sc1.ids.ml.clear_widgets() - self.root.ids.sc1.loadMessagelist(state.association) + self.root.ids.sc1.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) elif state.search_screen == 'addressbook': - self.root.ids.sc11.children[1].children[1].ids.search_field.text = '' - self.root.ids.sc11.ids.ml.clear_widgets() - self.root.ids.sc11.loadAddresslist(None, 'All', '') + self.root.ids.sc11.children[2].children[1].ids.search_field.text = '' + self.root.ids.sc11.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) elif state.search_screen == 'myaddress': try: self.root.ids.sc10.children[3].children[1].ids.search_field.text = '' except Exception: self.root.ids.sc10.children[2].children[1].ids.search_field.text = '' - self.root.ids.sc10.ids.ml.clear_widgets() - self.root.ids.sc10.init_ui() + self.root.ids.sc10.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) else: - self.root.ids.sc4.children[1].children[1].ids.search_field.text = '' - self.root.ids.sc4.ids.ml.clear_widgets() - self.root.ids.sc4.loadSent(state.association) + self.root.ids.sc4.children[2].children[1].ids.search_field.text = '' + self.root.ids.sc4.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) return def set_identicon(self, text): @@ -1364,13 +1547,15 @@ class GrashofPopup(Popup): stored_address = [addr[1] for addr in kivy_helper_search.search_sql( folder="addressbook")] - if label and address and address not in stored_address: + stored_labels = [labels[0] for labels in kivy_helper_search.search_sql( + folder="addressbook")] + if label and address and address not in stored_address and label not in stored_labels: # state.navinstance = self.parent.children[1] queues.UISignalQueue.put(('rerenderAddressBook', '')) self.dismiss() sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address) - state.kivyapp.root.ids.sc11.ids.ml.clear_widgets() - state.kivyapp.root.ids.sc11.loadAddresslist(None, 'All', '') + self.parent.children[1].ids.sc11.ids.ml.clear_widgets() + self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '') self.parent.children[1].ids.scr_mngr.current = 'addressbook' toast('Saved') @@ -1400,7 +1585,7 @@ class GrashofPopup(Popup): toast('Canceled') def checkAddress_valid(self, instance): - """Checking is address is valid or not""" + """Checking address is valid or not""" my_addresses = self.parent.children[1].children[2].children[0].ids.btn.values add_book = [addr[1] for addr in kivy_helper_search.search_sql( folder="addressbook")] @@ -1411,18 +1596,26 @@ class GrashofPopup(Popup): text = 'You can not save your own address.' if entered_text in my_addresses or entered_text in add_book: - if len(self.ids.popup_box.children) <= 2: - err_msg = MDLabel( - id='erro_msg', - font_style='Body2', - text=text, - font_size=5) - err_msg.color = 1, 0, 0, 1 - self.ids.popup_box.add_widget(err_msg) - self.ids.save_addr.disabled = True - elif len(self.ids.popup_box.children) > 2: - self.ids.popup_box.remove_widget(self.ids.popup_box.children[0]) - self.ids.save_addr.disabled = False + self.ids.address.error = True + self.ids.address.helper_text = text + elif entered_text: + self.ids.address.error = False + else: + self.ids.address.error = False + self.ids.address.helper_text = 'This field is required' + + def checkLabel_valid(self, instance): + """Checking address label is unique of not""" + entered_label = instance.text.strip() + addr_labels = [labels[0] for labels in kivy_helper_search.search_sql(folder="addressbook")] + if entered_label in addr_labels: + self.ids.label.error = True + self.ids.label.helper_text = 'label name already exists.' + elif entered_label: + self.ids.label.error = False + else: + self.ids.label.error = False + self.ids.label.helper_text = 'This field is required' class AvatarSampleWidget(ILeftBody, Image): @@ -1519,6 +1712,7 @@ class MailDetail(Screen): def delete_mail(self): """Method for mail delete.""" msg_count_objs = state.kivyapp.root.children[2].children[0].ids + state.searcing_text = '' if state.detailPageType == 'sent': sqlExecute( "UPDATE sent SET folder = 'trash' WHERE" @@ -1650,7 +1844,13 @@ class AddbookDetailPopup(Popup): def update_addbook_label(self, address): """Updating the label of address book address.""" - if str(self.ids.add_label.text): + address_list = kivy_helper_search.search_sql(folder="addressbook") + stored_labels = [labels[0] for labels in address_list] + add_dict = dict(address_list) + label = str(self.ids.add_label.text) + if label in stored_labels and self.address == add_dict[label]: + stored_labels.remove(label) + if label and label not in stored_labels: sqlExecute( "UPDATE addressbook SET label = '{}' WHERE" " address = '{}';".format(str(self.ids.add_label.text), address)) @@ -1676,6 +1876,21 @@ class AddbookDetailPopup(Popup): """Pop is Canceled.""" toast('Canceled') + def checkLabel_valid(self, instance): + """Checking address label is unique of not""" + entered_label = str(instance.text.strip()) + address_list = kivy_helper_search.search_sql(folder="addressbook") + addr_labels = [labels[0] for labels in address_list] + add_dict = dict(address_list) + if self.address and entered_label in addr_labels and self.address != add_dict[entered_label]: + self.ids.add_label.error = True + self.ids.add_label.helper_text = 'label name already exists.' + elif entered_label: + self.ids.add_label.error = False + else: + self.ids.add_label.error = False + self.ids.add_label.helper_text = 'This field is required' + class ShowQRCode(Screen): """ShowQRCode Screen uses to show the detail of mails.""" @@ -1694,6 +1909,8 @@ class Draft(Screen): """Draft screen is used to show the list of draft messages.""" data = ListProperty() + queryreturn = ListProperty() + has_refreshed = True def __init__(self, *args, **kwargs): """Method used for storing draft messages.""" @@ -1716,48 +1933,16 @@ class Draft(Screen): def loadDraft(self, account, where="", what=""): """Load draft list for Draft messages.""" xAddress = 'fromaddress' - queryreturn = kivy_helper_search.search_sql( + self.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: + state.msg_counter_objs.draft_cnt.badge_text = str(len(self.queryreturn)) + if self.queryreturn: src_mng_obj = state.kivyapp.root.children[2].children[0].ids - src_mng_obj.draft_cnt.badge_text = str(len(queryreturn)) - state.draft_count = str(len(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, - 'ackdata': mail[5]}) - 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')) - meny.bind(on_press=partial( - self.draft_detail, item['ackdata'])) - carousel = Carousel(direction='right') - carousel.height = meny.height - 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_draft, item['ackdata'])) - carousel.add_widget(del_btn) - carousel.add_widget(meny) - carousel.index = 1 - self.ids.ml.add_widget(carousel) + src_mng_obj.draft_cnt.badge_text = str(len(self.queryreturn)) + state.draft_count = str(len(self.queryreturn)) + self.set_mdList(0,20) + self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -1769,6 +1954,59 @@ class Draft(Screen): valign='top') self.ids.ml.add_widget(content) + def set_mdList(self, first_index, last_index): + """This method is used to create mdlist""" + data = [] + for mail in self.queryreturn[first_index:last_index]: + third_text = mail[3].replace('\n', ' ') + 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, + 'ackdata': mail[5]}) + for item in 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')) + meny.bind(on_press=partial( + self.draft_detail, item['ackdata'])) + carousel = Carousel(direction='right') + carousel.height = meny.height + 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_draft, item['ackdata'])) + carousel.add_widget(del_btn) + carousel.add_widget(meny) + carousel.index = 1 + self.ids.ml.add_widget(carousel) + + def check_scroll_y(self, instance, somethingelse): + """This method is used to load data on scroll""" + if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: + self.ids.scroll_y.scroll_y = 0.06 + total_draft_msg = len(self.ids.ml.children) + if total_draft_msg != len(self.queryreturn): + self.update_draft_screen_on_scroll(total_draft_msg) + self.has_refreshed = True if total_draft_msg != len(self.queryreturn) else False + else: + pass + + def update_draft_screen_on_scroll(self, total_draft_msg): + """This method is used to load more data on scroll down""" + self.set_mdList(total_draft_msg,total_draft_msg+5) + def draft_detail(self, ackdata, *args): """Method used to show draft Details.""" state.detailPageType = 'draft' @@ -1859,6 +2097,8 @@ class Allmails(Screen): """all mails Screen uses screen to show widgets of screens.""" data = ListProperty() + has_refreshed = True + all_mails = ListProperty() def __init__(self, *args, **kwargs): """Method Parsing the address.""" @@ -1880,42 +2120,16 @@ class Allmails(Screen): def loadMessagelist(self, account, where="", what=""): """Load Inbox, Sent anf Draft list of messages.""" - all_mails = sqlQuery( + self.all_mails = sqlQuery( "SELECT toaddress, fromaddress, subject, message, folder, ackdata As id, DATE(lastactiontime)" " As actionTime FROM sent WHERE folder = 'sent' UNION" " SELECT toaddress, fromaddress, subject, message, folder, msgid As id, DATE(received) As" " actionTime FROM inbox WHERE folder = 'inbox' ORDER BY actionTime DESC") - if all_mails: - state.kivyapp.root.children[2].children[0].ids.allmail_cnt.badge_text = str(len(all_mails)) - state.all_count = str(len(all_mails)) - for item in all_mails: - meny = TwoLineAvatarIconListItem( - text=item[1], - secondary_text=item[2][:50] + '........' if len( - item[2]) >= 50 else ( - item[2] + ',' + item[3].replace('\n', ''))[0:50] + '........', - theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color) - meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - avatarImageFirstLetter(item[2].strip())))) - meny.bind(on_press=partial( - self.mail_detail, item[5], item[4])) - carousel = Carousel(direction='right') - carousel.height = meny.height - 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.swipe_delete, item[5], item[4])) - carousel.add_widget(del_btn) - carousel.add_widget(meny) - carousel.index = 1 - self.ids.ml.add_widget(carousel) + if self.all_mails: + state.kivyapp.root.children[2].children[0].ids.allmail_cnt.badge_text = str(len(self.all_mails)) + state.all_count = str(len(self.all_mails)) + self.set_mdlist(0, 20) + self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -1927,6 +2141,52 @@ class Allmails(Screen): valign='top') self.ids.ml.add_widget(content) + def set_mdlist(self, start_pnt, end_pnt): + """This method is used to create mdList for allmaills""" + for item in self.all_mails[start_pnt:end_pnt]: + meny = TwoLineAvatarIconListItem( + text=item[1], + secondary_text=item[2][:50] + '........' if len( + item[2]) >= 50 else ( + item[2] + ',' + item[3].replace('\n', ''))[0:50] + '........', + theme_text_color='Custom', + text_color=NavigateApp().theme_cls.primary_color) + meny.add_widget(AvatarSampleWidget( + source='./images/text_images/{}.png'.format( + avatarImageFirstLetter(item[2].strip())))) + meny.bind(on_press=partial( + self.mail_detail, item[5], item[4])) + carousel = Carousel(direction='right') + carousel.height = meny.height + 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.swipe_delete, item[5], item[4])) + carousel.add_widget(del_btn) + carousel.add_widget(meny) + carousel.index = 1 + self.ids.ml.add_widget(carousel) + + def check_scroll_y(self, instance, somethingelse): + """This method is used for scrolling on fixing length""" + if self.ids.refresh_layout.scroll_y <= -0.00 and self.has_refreshed: + self.ids.refresh_layout.scroll_y = .06 + load_more = len(self.ids.ml.children) + self.updating_allmail(load_more) + pass + + def updating_allmail(self, load_more): + """This method is used to update the all mail listing value on the scroll of screen""" + if self.all_mails and load_more != len(self.all_mails): + state.all_count = str(len(self.all_mails)) + self.set_mdlist(load_more, load_more+5) + self.has_refreshed = True if load_more != len(self.all_mails) else False + def mail_detail(self, unique_id, folder, *args): """Load sent and inbox mail details.""" state.detailPageType = folder diff --git a/src/state.py b/src/state.py index 1a55b248..54251270 100644 --- a/src/state.py +++ b/src/state.py @@ -107,4 +107,6 @@ write_msg = {} availabe_credit = 0 -in_sent_method = False \ No newline at end of file +in_sent_method = False + +in_search_mode = False \ No newline at end of file From ccc21b33b0fe4132c8da267e89812a64b0cd08fc Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Thu, 21 Nov 2019 15:37:08 +0530 Subject: [PATCH 06/22] identiconGeneration fixes --- src/bitmessagekivy/identiconGeneration.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/bitmessagekivy/identiconGeneration.py b/src/bitmessagekivy/identiconGeneration.py index a5dcf3d0..ca8bd3bd 100644 --- a/src/bitmessagekivy/identiconGeneration.py +++ b/src/bitmessagekivy/identiconGeneration.py @@ -1,16 +1,15 @@ """ -src/identiconGeneration.py -================================= +Core classes for loading images and converting them to a Texture. +The raw image data can be keep in memory for further access """ -# pylint: disable=import-error + import hashlib from io import BytesIO from PIL import Image from kivy.core.image import Image as CoreImage from kivy.uix.image import Image as kiImage -""" Core classes for loading images and converting them to a Texture. -The raw image data can be keep in memory for further access """ +# pylint: disable=import-error # constants From 6c9d1a26667e13a08c19de517ed1489c5012a507 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Thu, 21 Nov 2019 15:37:22 +0530 Subject: [PATCH 07/22] kivy_helper_search fixes --- src/bitmessagekivy/kivy_helper_search.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bitmessagekivy/kivy_helper_search.py b/src/bitmessagekivy/kivy_helper_search.py index 16767fce..390d6fbd 100644 --- a/src/bitmessagekivy/kivy_helper_search.py +++ b/src/bitmessagekivy/kivy_helper_search.py @@ -1,6 +1,5 @@ """ -src/bitmessagekivy/kivy_helper_search.py -================================= +Sql queries for bitmessagekivy """ from helper_sql import sqlQuery @@ -14,14 +13,15 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w what = None if folder == "sent" or folder == "draft": - sqlStatementBase = ''' - SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime - FROM sent ''' + sqlStatementBase = ( + '''SELECT toaddress, fromaddress, subject, message, status, ackdata,''' + ''' lastactiontime FROM sent ''') elif folder == "addressbook": sqlStatementBase = '''SELECT label, address From addressbook ''' else: - sqlStatementBase = '''SELECT folder, msgid, toaddress, message, fromaddress, subject, received, read - FROM inbox ''' + sqlStatementBase = ( + '''SELECT folder, msgid, toaddress, message, fromaddress, subject,''' + ''' received, read FROM inbox ''') sqlStatementParts = [] sqlArguments = [] From c08a49aec23343ef4e956c588e3fb7281f3a5058 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Thu, 21 Nov 2019 20:20:14 +0530 Subject: [PATCH 08/22] mpybit fixes --- src/bitmessagekivy/mpybit.py | 280 ++++++++++++++++++++++------------- 1 file changed, 179 insertions(+), 101 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index fdcf2da6..f85831da 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1,8 +1,8 @@ """ -src/bitmessagekivy/mpybit.py -================================= +Bitmessage kivy interface """ -# pylint: disable=relative-import, unused-variable, import-error, no-name-in-module, too-many-lines +# pylint: disable=relative-import, unused-variable, import-error +# pylint: disable=no-name-in-module, too-many-lines, unused-argument import os import time from functools import partial @@ -62,7 +62,6 @@ import state from uikivysignaler import UIkivySignaler import identiconGeneration -# pylint: disable=unused-argument, too-few-public-methods def toast(text): @@ -123,12 +122,13 @@ class Inbox(Screen): data.append({ 'text': mail[4].strip(), 'secondary_text': mail[5][:50] + '........' if len( - mail[5]) >= 50 else ( - mail[5] + ',' + mail[3].replace('\n', ''))[0:50] + '........', + mail[5]) >= 50 else (mail[5] + ',' + mail[3].replace( + '\n', ''))[0:50] + '........', 'msgid': mail[1]}) self.has_refreshed = True self.set_mdList(data) - self.children[2].children[0].children[0].bind(scroll_y=self.check_scroll_y) + self.children[2].children[0].children[0].bind( + scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -177,12 +177,14 @@ class Inbox(Screen): def check_scroll_y(self, instance, somethingelse): """This method is used to load data on scroll""" - if self.children[2].children[0].children[0].scroll_y <= -0.0 and self.has_refreshed: + if self.children[2].children[0].children[ + 0].scroll_y <= -0.0 and self.has_refreshed: self.children[2].children[0].children[0].scroll_y = 0.06 total_message = len(self.ids.ml.children) if total_message != len(self.queryreturn): self.update_inbox_screen_on_scroll(total_message) - self.has_refreshed = True if total_message != len(self.queryreturn) else False + self.has_refreshed = True if total_message != len( + self.queryreturn) else False else: pass @@ -194,8 +196,8 @@ class Inbox(Screen): data.append({ 'text': mail[4].strip(), 'secondary_text': mail[5][:50] + '........' if len( - mail[5]) >= 50 else ( - mail[5] + ',' + mail[3].replace('\n', ''))[0:50] + '........', + mail[5]) >= 50 else (mail[5] + ',' + mail[3].replace( + '\n', ''))[0:50] + '........', 'msgid': mail[1]}) self.set_mdList(data) @@ -217,9 +219,12 @@ class Inbox(Screen): "UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str( data_index)) try: - msg_count_objs = self.parent.parent.parent.parent.children[2].children[0].ids + msg_count_objs = ( + self.parent.parent.parent.parent.children[2].children[0].ids) except Exception: - msg_count_objs = self.parent.parent.parent.parent.parent.children[2].children[0].ids + msg_count_objs = ( + self.parent.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) @@ -257,7 +262,8 @@ class Inbox(Screen): # pylint: disable=attribute-defined-outside-init def refresh_callback(self, *args): - """Method updates the state of application, While the spinner remains on the screen.""" + """Method updates the state of application, + While the spinner remains on the screen.""" def refresh_callback(interval): """Method used for loading the inbox screen data.""" state.searcing_text = '' @@ -271,6 +277,7 @@ class Inbox(Screen): Clock.schedule_once(refresh_callback, 1) def set_root_layout(self): + """Setting root layout""" return self.parent.parent.parent @@ -329,7 +336,8 @@ class MyAddress(Screen): theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format(avatarImageFirstLetter(item['text'].strip())))) + source='./images/text_images/{}.png'.format( + avatarImageFirstLetter(item['text'].strip())))) meny.bind(on_press=partial( self.myadd_detail, item['secondary_text'], item['text'])) self.ids.ml.add_widget(meny) @@ -341,13 +349,14 @@ class MyAddress(Screen): my_addresses = len(self.ids.ml.children) if my_addresses != len(self.addresses_list): self.update_addressBook_on_scroll(my_addresses) - self.has_refreshed = True if my_addresses != len(self.addresses_list) else False + self.has_refreshed = True if my_addresses != len( + self.addresses_list) else False else: pass def update_addressBook_on_scroll(self, my_addresses): """This method is used to load more data on scroll down""" - self.set_mdList(my_addresses,my_addresses + 20) + self.set_mdList(my_addresses, my_addresses + 20) @staticmethod def myadd_detail(fromaddress, label, *args): @@ -358,7 +367,8 @@ class MyAddress(Screen): # pylint: disable=attribute-defined-outside-init def refresh_callback(self, *args): - """Method updates the state of application, While the spinner remains on the screen.""" + """Method updates the state of application, + While the spinner remains on the screen.""" def refresh_callback(interval): """Method used for loading the myaddress screen data.""" state.searcing_text = '' @@ -382,6 +392,7 @@ class MyAddress(Screen): return False def set_root_layout(self): + """Setting root layout""" return self.manager.parent.parent @@ -411,7 +422,7 @@ class AddressBook(Screen): self.queryreturn = [obj for obj in reversed(self.queryreturn)] if self.queryreturn: self.has_refreshed = True - self.set_mdList(0,20) + self.set_mdList(0, 20) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( @@ -434,7 +445,8 @@ class AddressBook(Screen): theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format(avatarImageFirstLetter(item[0].strip())))) + source='./images/text_images/{}.png'.format( + avatarImageFirstLetter(item[0].strip())))) meny.bind(on_press=partial( self.addBook_detail, item[1], item[0])) carousel = Carousel(direction='right') @@ -459,13 +471,14 @@ class AddressBook(Screen): exist_addresses = len(self.ids.ml.children) if exist_addresses != len(self.queryreturn): self.update_addressBook_on_scroll(exist_addresses) - self.has_refreshed = True if exist_addresses != len(self.queryreturn) else False + self.has_refreshed = True if exist_addresses != len( + self.queryreturn) else False else: pass def update_addressBook_on_scroll(self, exist_addresses): """This method is used to load more data on scroll down""" - self.set_mdList(exist_addresses,exist_addresses + 20) + self.set_mdList(exist_addresses, exist_addresses + 20) @staticmethod def refreshs(*args): @@ -488,9 +501,10 @@ class AddressBook(Screen): "DELETE FROM addressbook WHERE address = '{}';".format(address)) -class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior, - RecycleBoxLayout): +class SelectableRecycleBoxLayout( + FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout): """Adds selection and focus behaviour to the view.""" + # pylint: disable = too-many-ancestors pass @@ -536,7 +550,8 @@ class RV(RecycleView): class DropDownWidget(BoxLayout): """Adding Dropdown Widget.""" - # pylint: disable=too-many-statements, inconsistent-return-statements, too-many-locals + # pylint: disable=too-many-statements, too-many-locals + # pylint: disable=inconsistent-return-statements txt_input = ObjectProperty() rv = ObjectProperty() @@ -553,7 +568,8 @@ class DropDownWidget(BoxLayout): if sendMessageToPeople: if toAddress != '' and subject and message: from addresses import decodeAddress - status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress) + status, addressVersionNumber, streamNumber, ripe = ( + decodeAddress(toAddress)) if status == 'success': navApp.root.ids.sc3.children[0].active = True if state.detailPageType == 'draft' and state.send_draft_mail: @@ -575,9 +591,10 @@ class DropDownWidget(BoxLayout): from addresses import addBMIfNotPresent toAddress = addBMIfNotPresent(toAddress) statusIconColor = 'red' - if addressVersionNumber > 4 or addressVersionNumber <= 1: - print "addressVersionNumber > 4 \ - or addressVersionNumber <= 1" + if (addressVersionNumber > 4) or ( + addressVersionNumber <= 1): + print "addressVersionNumber > 4"\ + " or addressVersionNumber <= 1" if streamNumber > 1 or streamNumber == 0: print "streamNumber > 1 or streamNumber == 0" if statusIconColor == 'red': @@ -631,7 +648,9 @@ class DropDownWidget(BoxLayout): msg = 'Please fill the form' self.address_error_message(msg) - def callback_for_msgsend(self, dt=0): + @staticmethod + def callback_for_msgsend(dt=0): + """Callback method for messagesend""" state.kivyapp.root.ids.sc3.children[0].active = False state.in_sent_method = True state.kivyapp.back_press() @@ -711,13 +730,18 @@ class Payment(Screen): """Method helps to 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 + existing_credits = ( + state.kivyapp.root.ids.sc18.ids.ml.children[0].children[ + 0].children[0].children[0].text) if len(existing_credits.split(' ')) > 1: - toast('We already have added free coins for the subscription to your account!') + 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.ml.children[0].children[ + 0].children[0].children[0].text = '{0}'.format( + state.availabe_credit) class Credits(Screen): @@ -787,7 +811,8 @@ class Random(Screen): eighteenByteRipe = False nonceTrialsPerByte = 1000 payloadLengthExtraBytes = 1000 - lables = [BMConfigParser().get(obj, 'label') for obj in BMConfigParser().addresses()] + lables = [BMConfigParser().get(obj, 'label') + for obj in BMConfigParser().addresses()] if entered_label and entered_label not in lables: toast('Address Creating...') queues.addressGeneratorQueue.put(( @@ -814,7 +839,8 @@ class Random(Screen): def add_validation(self, instance): """Checking validation at address creation time.""" entered_label = str(instance.text.strip()) - lables = [BMConfigParser().get(obj, 'label') for obj in BMConfigParser().addresses()] + lables = [BMConfigParser().get(obj, 'label') + for obj in BMConfigParser().addresses()] if entered_label in lables: self.ids.label.error = True self.ids.label.helper_text = 'Label name is already exist' @@ -857,8 +883,10 @@ class Sent(Screen): data = [] self.queryreturn = kivy_helper_search.search_sql( xAddress, account, "sent", where, what, False) - if state.msg_counter_objs and state.association == state.check_sent_acc: - state.msg_counter_objs.send_cnt.badge_text = str(len(self.queryreturn)) + if state.msg_counter_objs and state.association == ( + state.check_sent_acc): + state.msg_counter_objs.send_cnt.badge_text = str( + len(self.queryreturn)) state.sent_count = str(int(state.sent_count) + 1) state.all_count = str(int(state.all_count) + 1) state.msg_counter_objs.allmail_cnt.badge_text = state.all_count @@ -870,8 +898,8 @@ class Sent(Screen): 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] + '........', + mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace( + '\n', ''))[0:50] + '........', 'ackdata': mail[5]}) self.set_mdlist(data, 0) self.has_refreshed = True @@ -924,7 +952,7 @@ class Sent(Screen): def update_sent_messagelist(self): """This method is used to update screen when new mail is sent""" - if len(self.ids.ml.children) <3: + if len(self.ids.ml.children) < 3: self.ids.ml.clear_widgets() self.loadSent(state.association) else: @@ -938,10 +966,10 @@ class Sent(Screen): 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] + '........', + mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace( + '\n', ''))[0:50] + '........', 'ackdata': mail[5]}) - self.set_mdlist(data, total_sent-1) + self.set_mdlist(data, total_sent - 1) def check_scroll_y(self, instance, somethingelse): """This method is used to load data on scroll""" @@ -950,7 +978,8 @@ class Sent(Screen): total_sent_msg = len(self.ids.ml.children) if total_sent_msg != len(self.queryreturn): self.update_sent_screen_on_scroll(total_sent_msg) - self.has_refreshed = True if total_sent_msg != len(self.queryreturn) else False + self.has_refreshed = True if total_sent_msg != len( + self.queryreturn) else False else: pass @@ -961,12 +990,13 @@ class Sent(Screen): 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] + '........', + mail[2]) >= 50 else (mail[2] + ',' + mail[3].replace( + '\n', ''))[0:50] + '........', 'ackdata': mail[5]}) self.set_mdlist(data, 0) - def set_sentCount(self, total_sent): + @staticmethod + def set_sentCount(total_sent): """Set the total no. of sent message count""" src_mng_obj = state.kivyapp.root.children[2].children[0].ids src_mng_obj.send_cnt.badge_text = str(total_sent) @@ -1047,15 +1077,16 @@ class Trash(Screen): if BMConfigParser().addresses(): state.association = BMConfigParser().addresses()[0] self.trash_messages = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder, ackdata As id, DATE(lastactiontime)" - " As actionTime FROM sent WHERE folder = 'trash' UNION" - " SELECT toaddress, fromaddress, subject, message, folder, msgid As id, DATE(received) As" - " actionTime FROM inbox WHERE folder = 'trash' ORDER BY actionTime DESC") + "SELECT toaddress, fromaddress, subject, message, folder, ackdata" + " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" + " folder = 'trash' UNION SELECT toaddress, fromaddress, subject," + " message, folder, msgid As id, DATE(received) As actionTime FROM" + " inbox WHERE folder = 'trash' ORDER BY actionTime DESC") if self.trash_messages: src_mng_obj = state.kivyapp.root.children[2].children[0].ids src_mng_obj.trash_cnt.badge_text = str(len(self.trash_messages)) state.trash_count = str(len(self.trash_messages)) - self.set_mdList(0,20) + self.set_mdList(0, 20) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( @@ -1074,8 +1105,8 @@ class Trash(Screen): meny = TwoLineAvatarIconListItem( text=item[1], secondary_text=item[2][:50] + '........' if len( - item[2]) >= 50 else ( - item[2] + ',' + item[3].replace('\n', ''))[0:50] + '........', + item[2]) >= 50 else (item[2] + ',' + item[3].replace( + '\n', ''))[0:50] + '........', theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) img_latter = './images/text_images/{}.png'.format( @@ -1105,13 +1136,14 @@ class Trash(Screen): total_trash_msg = len(self.ids.ml.children) if total_trash_msg != len(self.trash_messages): self.update_trash_screen_on_scroll(total_trash_msg) - self.has_refreshed = True if total_trash_msg != len(self.trash_messages) else False + self.has_refreshed = True if total_trash_msg != len( + self.trash_messages) else False else: pass def update_trash_screen_on_scroll(self, total_trash_msg): """This method is used to load more data on scroll down""" - self.set_mdList(total_trash_msg,total_trash_msg+5) + self.set_mdList(total_trash_msg, total_trash_msg + 5) def delete_permanently(self, data_index, instance, *args): """Deleting trash mail permanently.""" @@ -1232,7 +1264,8 @@ class NavigateApp(App): self.root.ids.sc17.add_widget(Allmails()) self.root.ids.scr_mngr.current = 'inbox' - msg_counter_objs = self.root_window.children[2].children[2].children[0].ids + msg_counter_objs = ( + self.root_window.children[2].children[2].children[0].ids) state.sent_count = str( sqlQuery( "SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and" @@ -1278,12 +1311,16 @@ class NavigateApp(App): img = identiconGeneration.generate(BMConfigParser().addresses()[0]) self.createFolder('./images/default_identicon/') if platform == 'android': - # android_path = os.path.expanduser("~/user/0/org.test.bitapp/files/app/") - android_path = os.path.join(os.environ['ANDROID_PRIVATE'] + '/app/') + # android_path = os.path.expanduser + # ("~/user/0/org.test.bitapp/files/app/") + android_path = os.path.join( + os.environ['ANDROID_PRIVATE'] + '/app/') img.texture.save('{1}/images/default_identicon/{0}.png'.format( BMConfigParser().addresses()[0], android_path)) else: - img.texture.save('./images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0])) + img.texture.save( + './images/default_identicon/{}.png'.format( + BMConfigParser().addresses()[0])) return BMConfigParser().addresses()[0] return 'Select Address' @@ -1300,7 +1337,8 @@ class NavigateApp(App): def get_default_image(): """Getting default image on address""" if BMConfigParser().addresses(): - return './images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0]) + return './images/default_identicon/{}.png'.format( + BMConfigParser().addresses()[0]) return './images/no_identicons.png' @staticmethod @@ -1313,7 +1351,8 @@ class NavigateApp(App): def on_key(self, window, key, *args): """Method is used for going on previous screen.""" if key == 27: - if state.in_search_mode and self.root.ids.scr_mngr.current != "mailDetail": + if state.in_search_mode and self.root.ids.scr_mngr.current != ( + "mailDetail"): self.closeSearchScreen() elif self.root.ids.scr_mngr.current == "mailDetail": self.root.ids.scr_mngr.current = 'sent'\ @@ -1369,6 +1408,7 @@ class NavigateApp(App): self.root.ids.scr_mngr.current = state.search_screen def save_draft(self): + """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) @@ -1405,12 +1445,17 @@ class NavigateApp(App): self.root.ids.toolbar.left_action_items = [ ['arrow-left', lambda x: self.back_press()]] self.root.ids.toolbar.right_action_items = [ - ['refresh', lambda x: self.root.ids.sc3.children[1].reset_composer()], - ['send', lambda x: self.root.ids.sc3.children[1].send(self)]] + ['refresh', + lambda x: self.root.ids.sc3.children[1].reset_composer()], + ['send', + lambda x: self.root.ids.sc3.children[1].send(self)]] def set_common_header(self): - self.root.ids.toolbar.right_action_items = [['account-plus', lambda x: self.addingtoaddressbook()]] - self.root.ids.toolbar.left_action_items = [['menu', lambda x: self.root.toggle_nav_drawer()]] + """Common for all window""" + self.root.ids.toolbar.right_action_items = [ + ['account-plus', lambda x: self.addingtoaddressbook()]] + self.root.ids.toolbar.left_action_items = [ + ['menu', lambda x: self.root.toggle_nav_drawer()]] return def back_press(self): @@ -1418,7 +1463,8 @@ class NavigateApp(App): self.save_draft() if self.root.ids.scr_mngr.current == 'mailDetail' and state.in_search_mode: toolbar_obj = self.root.ids.toolbar - toolbar_obj.left_action_items = [['arrow-left', lambda x: self.closeSearchScreen()]] + toolbar_obj.left_action_items = [ + ['arrow-left', lambda x: self.closeSearchScreen()]] toolbar_obj.right_action_items = [] self.root.ids.toolbar.title = '' else: @@ -1452,7 +1498,8 @@ class NavigateApp(App): addr = BMConfigParser().addresses()[0] first_name = BMConfigParser().get(addr, 'label') f_name = first_name.split() - label = f_name[0][:14].capitalize() + '...' if len(f_name[0]) > 15 else f_name[0].capitalize() + label = f_name[0][:14].capitalize() + '...' if len( + f_name[0]) > 15 else f_name[0].capitalize() address = ' (' + addr + '...)' return label + address return '' @@ -1463,7 +1510,8 @@ class NavigateApp(App): state.searcing_text = str(instance.text).strip() if instance.focus and state.searcing_text: toolbar_obj = self.root.ids.toolbar - toolbar_obj.left_action_items = [['arrow-left', lambda x: self.closeSearchScreen()]] + toolbar_obj.left_action_items = [ + ['arrow-left', lambda x: self.closeSearchScreen()]] toolbar_obj.right_action_items = [] self.root.ids.toolbar.title = '' state.in_search_mode = True @@ -1472,7 +1520,8 @@ class NavigateApp(App): """Function for close search screen""" self.set_common_header() address_label = self.current_address_label( - BMConfigParser().get(state.association, 'label'), state.association) + BMConfigParser().get( + state.association, 'label'), state.association) self.root.ids.toolbar.title = address_label state.searcing_text = '' self.refreshScreen() @@ -1508,20 +1557,27 @@ class NavigateApp(App): def set_identicon(self, text): """This method is use for showing identicon in address spinner""" img = identiconGeneration.generate(text) - self.root.children[2].children[0].ids.btn.children[1].texture = img.texture + self.root.children[2].children[0].ids.btn.children[1].texture = ( + img.texture) def set_mail_detail_header(self): """Method is used for setting the details of the page""" toolbar_obj = self.root.ids.toolbar - toolbar_obj.left_action_items = [['arrow-left', lambda x: self.back_press()]] - delete_btn = ['delete-forever', lambda x: self.root.ids.sc14.delete_mail()] + toolbar_obj.left_action_items = [ + ['arrow-left', lambda x: self.back_press()]] + delete_btn = ['delete-forever', + lambda x: self.root.ids.sc14.delete_mail()] dynamic_list = [] if state.detailPageType == 'inbox': - dynamic_list = [['reply', lambda x: self.root.ids.sc14.inbox_reply()], delete_btn] + dynamic_list = [ + ['reply', lambda x: self.root.ids.sc14.inbox_reply()], + delete_btn] elif state.detailPageType == 'sent': dynamic_list = [delete_btn] elif state.detailPageType == 'draft': - dynamic_list = [['pencil', lambda x: self.root.ids.sc14.write_msg(self)], delete_btn] + dynamic_list = [ + ['pencil', lambda x: self.root.ids.sc14.write_msg(self)], + delete_btn] toolbar_obj.right_action_items = dynamic_list @@ -1586,7 +1642,8 @@ class GrashofPopup(Popup): def checkAddress_valid(self, instance): """Checking address is valid or not""" - my_addresses = self.parent.children[1].children[2].children[0].ids.btn.values + my_addresses = ( + self.parent.children[1].children[2].children[0].ids.btn.values) add_book = [addr[1] for addr in kivy_helper_search.search_sql( folder="addressbook")] entered_text = str(instance.text).strip() @@ -1607,7 +1664,9 @@ class GrashofPopup(Popup): def checkLabel_valid(self, instance): """Checking address label is unique of not""" entered_label = instance.text.strip() - addr_labels = [labels[0] for labels in kivy_helper_search.search_sql(folder="addressbook")] + addr_labels = [labels[0] + for labels in kivy_helper_search.search_sql( + folder="addressbook")] if entered_label in addr_labels: self.ids.label.error = True self.ids.label.helper_text = 'label name already exists.' @@ -1725,22 +1784,26 @@ class MailDetail(Screen): sqlExecute( "UPDATE inbox SET folder = 'trash' WHERE" " msgid = ?;", str(state.mail_id)) - msg_count_objs.inbox_cnt.badge_text = str(int(state.inbox_count) - 1) + msg_count_objs.inbox_cnt.badge_text = str( + int(state.inbox_count) - 1) state.inbox_count = str(int(state.inbox_count) - 1) self.parent.screens[0].ids.ml.clear_widgets() self.parent.screens[0].loadMessagelist(state.association) elif state.detailPageType == 'draft': sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str( state.mail_id)) - msg_count_objs.draft_cnt.badge_text = str(int(state.draft_count) - 1) + msg_count_objs.draft_cnt.badge_text = str( + int(state.draft_count) - 1) state.draft_count = str(int(state.draft_count) - 1) self.parent.screens[15].clear_widgets() self.parent.screens[15].add_widget(Draft()) self.parent.current = 'allmails' if state.is_allmail else state.detailPageType if state.detailPageType != 'draft': - msg_count_objs.trash_cnt.badge_text = str(int(state.trash_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.allmail_cnt.badge_text = str( + int(state.all_count) - 1) state.trash_count = str(int(state.trash_count) + 1) state.all_count = str(int(state.all_count) - 1) self.parent.screens[4].clear_widgets() @@ -1772,11 +1835,13 @@ class MailDetail(Screen): def write_msg(self, navApp): """Method used to write on draft mail.""" state.send_draft_mail = state.mail_id - composer_ids = self.parent.parent.parent.parent.parent.ids.sc3.children[1].ids + composer_ids = ( + self.parent.parent.parent.parent.parent.ids.sc3.children[1].ids) composer_ids.ti.text = state.write_msg['from_addr'] composer_ids.btn.text = state.write_msg['from_addr'] composer_ids.txt_input.text = state.write_msg['to_addr'] - composer_ids.subject.text = state.write_msg['subject'] if state.write_msg['subject'] != '(no subject)' else '' + composer_ids.subject.text = state.write_msg[ + 'subject'] if state.write_msg['subject'] != '(no subject)' else '' composer_ids.body.text = state.write_msg['message'] self.parent.current = 'create' navApp.set_navbar_for_composer() @@ -1853,7 +1918,8 @@ class AddbookDetailPopup(Popup): if label and label not in stored_labels: sqlExecute( "UPDATE addressbook SET label = '{}' WHERE" - " address = '{}';".format(str(self.ids.add_label.text), address)) + " address = '{}';".format( + str(self.ids.add_label.text), address)) self.parent.children[1].ids.sc11.ids.ml.clear_widgets() self.parent.children[1].ids.sc11.loadAddresslist(None, 'All', '') self.dismiss() @@ -1936,12 +2002,13 @@ class Draft(Screen): self.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(self.queryreturn)) + state.msg_counter_objs.draft_cnt.badge_text = str( + len(self.queryreturn)) if self.queryreturn: src_mng_obj = state.kivyapp.root.children[2].children[0].ids src_mng_obj.draft_cnt.badge_text = str(len(self.queryreturn)) state.draft_count = str(len(self.queryreturn)) - self.set_mdList(0,20) + self.set_mdList(0, 20) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( @@ -1999,13 +2066,14 @@ class Draft(Screen): total_draft_msg = len(self.ids.ml.children) if total_draft_msg != len(self.queryreturn): self.update_draft_screen_on_scroll(total_draft_msg) - self.has_refreshed = True if total_draft_msg != len(self.queryreturn) else False + self.has_refreshed = True if total_draft_msg != len( + self.queryreturn) else False else: pass def update_draft_screen_on_scroll(self, total_draft_msg): """This method is used to load more data on scroll down""" - self.set_mdList(total_draft_msg,total_draft_msg+5) + self.set_mdList(total_draft_msg, total_draft_msg + 5) def draft_detail(self, ackdata, *args): """Method used to show draft Details.""" @@ -2024,7 +2092,8 @@ class Draft(Screen): sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str( data_index)) try: - msg_count_objs = self.parent.parent.parent.parent.children[2].children[0].ids + msg_count_objs = ( + self.parent.parent.parent.parent.children[2].children[0].ids) except Exception: msg_count_objs = self.parent.parent.parent.parent.parent.children[ 2].children[0].ids @@ -2048,7 +2117,8 @@ class Draft(Screen): sendMessageToPeople = True if sendMessageToPeople: from addresses import decodeAddress - status, addressVersionNumber, streamNumber, ripe = decodeAddress(toAddress) + status, addressVersionNumber, streamNumber, ripe = decodeAddress( + toAddress) from addresses import addBMIfNotPresent toAddress = addBMIfNotPresent(toAddress) statusIconColor = 'red' @@ -2121,12 +2191,14 @@ class Allmails(Screen): def loadMessagelist(self, account, where="", what=""): """Load Inbox, Sent anf Draft list of messages.""" self.all_mails = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder, ackdata As id, DATE(lastactiontime)" - " As actionTime FROM sent WHERE folder = 'sent' UNION" - " SELECT toaddress, fromaddress, subject, message, folder, msgid As id, DATE(received) As" - " actionTime FROM inbox WHERE folder = 'inbox' ORDER BY actionTime DESC") + "SELECT toaddress, fromaddress, subject, message, folder, ackdata" + " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" + " folder = 'sent' UNION SELECT toaddress, fromaddress, subject," + " message, folder, msgid As id, DATE(received) As actionTime" + " FROM inbox WHERE folder = 'inbox' ORDER BY actionTime DESC") if self.all_mails: - state.kivyapp.root.children[2].children[0].ids.allmail_cnt.badge_text = str(len(self.all_mails)) + state.kivyapp.root.children[2].children[0].ids.allmail_cnt.badge_text = str( + len(self.all_mails)) state.all_count = str(len(self.all_mails)) self.set_mdlist(0, 20) self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) @@ -2148,7 +2220,8 @@ class Allmails(Screen): text=item[1], secondary_text=item[2][:50] + '........' if len( item[2]) >= 50 else ( - item[2] + ',' + item[3].replace('\n', ''))[0:50] + '........', + item[2] + ',' + item[3].replace( + '\n', ''))[0:50] + '........', theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) meny.add_widget(AvatarSampleWidget( @@ -2178,14 +2251,17 @@ class Allmails(Screen): self.ids.refresh_layout.scroll_y = .06 load_more = len(self.ids.ml.children) self.updating_allmail(load_more) - pass + else: + pass def updating_allmail(self, load_more): - """This method is used to update the all mail listing value on the scroll of screen""" + """This method is used to update the all mail + listing value on the scroll of screen""" if self.all_mails and load_more != len(self.all_mails): state.all_count = str(len(self.all_mails)) - self.set_mdlist(load_more, load_more+5) - self.has_refreshed = True if load_more != len(self.all_mails) else False + self.set_mdlist(load_more, load_more + 5) + self.has_refreshed = True if load_more != len( + self.all_mails) else False def mail_detail(self, unique_id, folder, *args): """Load sent and inbox mail details.""" @@ -2259,6 +2335,7 @@ class Allmails(Screen): Clock.schedule_once(refresh_callback, 1) def set_root_layout(self): + """Setting root layout""" try: return self.manager.parent.parent except Exception as e: @@ -2297,6 +2374,7 @@ class Spam(Screen): class LoadingPopup(Popup): """Load Popup""" + def __init__(self, **kwargs): super(LoadingPopup, self).__init__(**kwargs) # call dismiss_popup in 2 seconds From 912a0a0a1e7496501140715f2fb9c1bdb1717f30 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Fri, 22 Nov 2019 17:03:20 +0530 Subject: [PATCH 09/22] mpybit quality fixes --- src/bitmessagekivy/mpybit.py | 152 +++++++++++++++++------------------ 1 file changed, 72 insertions(+), 80 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index f85831da..6413c448 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1,8 +1,8 @@ """ Bitmessage kivy interface """ -# pylint: disable=relative-import, unused-variable, import-error -# pylint: disable=no-name-in-module, too-many-lines, unused-argument +# pylint: disable=relative-import, import-error, no-name-in-module +# pylint: disable=too-few-public-methods, too-many-lines, unused-argument import os import time from functools import partial @@ -65,7 +65,7 @@ import identiconGeneration def toast(text): - """Method will display the toast message.""" + """Function displays toast message.""" # pylint: disable=redefined-outer-name from kivymd.toast.kivytoast import toast toast(text) @@ -73,8 +73,7 @@ def toast(text): class Navigatorss(MDNavigationDrawer): - """Navigators class contains image, title and logo.""" - + """Navigator class contains image, title and logo.""" image_source = StringProperty('images/qidenticon_two.png') title = StringProperty('Navigation') drawer_logo = StringProperty() @@ -118,7 +117,7 @@ class Inbox(Screen): src_mng_obj.inbox_cnt.badge_text = str(len(self.queryreturn)) state.inbox_count = str(len(self.queryreturn)) for mail in self.queryreturn[:20]: - third_text = mail[3].replace('\n', ' ') + # third_text = mail[3].replace('\n', ' ') data.append({ 'text': mail[4].strip(), 'secondary_text': mail[5][:50] + '........' if len( @@ -192,7 +191,7 @@ class Inbox(Screen): """This method is used to load more data on scroll down""" data = [] for mail in self.queryreturn[total_message:total_message + 5]: - third_text = mail[3].replace('\n', ' ') + # third_text = mail[3].replace('\n', ' ') data.append({ 'text': mail[4].strip(), 'secondary_text': mail[5][:50] + '........' if len( @@ -511,7 +510,6 @@ class SelectableRecycleBoxLayout( class SelectableLabel(RecycleDataViewBehavior, Label): """Add selection support to the Label.""" - index = None selected = BooleanProperty(False) selectable = BooleanProperty(True) @@ -552,7 +550,6 @@ class DropDownWidget(BoxLayout): """Adding Dropdown Widget.""" # pylint: disable=too-many-statements, too-many-locals # pylint: disable=inconsistent-return-statements - txt_input = ObjectProperty() rv = ObjectProperty() @@ -572,7 +569,8 @@ class DropDownWidget(BoxLayout): decodeAddress(toAddress)) if status == 'success': navApp.root.ids.sc3.children[0].active = True - if state.detailPageType == 'draft' and state.send_draft_mail: + if state.detailPageType == 'draft' \ + and state.send_draft_mail: sqlExecute( "UPDATE sent SET toaddress = ?" ", fromaddress = ? , subject = ?" @@ -603,7 +601,7 @@ class DropDownWidget(BoxLayout): 'bitmessagesettings', 'ackstealthlevel') from helper_ackPayload import genAckPayload ackdata = genAckPayload(streamNumber, stealthLevel) - t = () + # t = () sqlExecute( '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', @@ -635,7 +633,7 @@ class DropDownWidget(BoxLayout): self.parent.parent.screens[16].add_widget(Allmails()) # toast('sending...') Clock.schedule_once(self.callback_for_msgsend, 3) - toLabel = '' + # toLabel = '' queues.workerQueue.put(('sendmessage', toAddress)) print "sqlExecute successfully #######################" state.in_composer = True @@ -687,7 +685,6 @@ class DropDownWidget(BoxLayout): class MyTextInput(TextInput): """Takes the text input in the field.""" - txt_input = ObjectProperty() flt_list = ObjectProperty() word_list = ListProperty() @@ -746,19 +743,16 @@ class Payment(Screen): class Credits(Screen): """Credits Method""" - available_credits = StringProperty( - '{0}'.format('0')) + available_credits = StringProperty('{0}'.format('0')) class Login(Screen): """Login Screeen.""" - pass class NetworkStat(Screen): """Method used to show network stat.""" - text_variable_1 = StringProperty( '{0}::{1}'.format('Total Connections', '0')) text_variable_2 = StringProperty( @@ -793,13 +787,11 @@ class NetworkStat(Screen): class ContentNavigationDrawer(Navigatorss): """Navigate Content Drawer.""" - pass class Random(Screen): """Generates Random Address.""" - is_active = BooleanProperty(False) checked = StringProperty("") @@ -1179,7 +1171,6 @@ class Setting(Screen): class NavigateApp(App): """Navigation Layout of class.""" # pylint: disable=too-many-public-methods - theme_cls = ThemeManager() previous_date = ObjectProperty() obj_1 = ObjectProperty() @@ -1412,7 +1403,8 @@ class NavigateApp(App): 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' and not state.in_sent_method: + if from_addr and to_addr and state.detailPageType != 'draft' \ + and not state.in_sent_method: Draft().draft_msg(composer_objs) return @@ -1446,9 +1438,9 @@ class NavigateApp(App): ['arrow-left', lambda x: self.back_press()]] self.root.ids.toolbar.right_action_items = [ ['refresh', - lambda x: self.root.ids.sc3.children[1].reset_composer()], + lambda x: self.root.ids.sc3.children[1].reset_composer()], ['send', - lambda x: self.root.ids.sc3.children[1].send(self)]] + lambda x: self.root.ids.sc3.children[1].send(self)]] def set_common_header(self): """Common for all window""" @@ -1461,7 +1453,8 @@ class NavigateApp(App): def back_press(self): """Method used for going back from composer to previous page.""" self.save_draft() - if self.root.ids.scr_mngr.current == 'mailDetail' and state.in_search_mode: + if self.root.ids.scr_mngr.current == 'mailDetail' \ + and state.in_search_mode: toolbar_obj = self.root.ids.toolbar toolbar_obj.left_action_items = [ ['arrow-left', lambda x: self.closeSearchScreen()]] @@ -1527,32 +1520,39 @@ class NavigateApp(App): self.refreshScreen() state.in_search_mode = False - def refreshScreen(self): - """Method show search button only on inbox or sent screen.""" - state.searcing_text = '' - if state.search_screen == 'inbox': - try: - self.root.ids.sc1.children[3].children[1].ids.search_field.text = '' - except Exception: - self.root.ids.sc1.children[2].children[1].ids.search_field.text = '' - self.root.ids.sc1.children[1].active = True - Clock.schedule_once(self.search_callback, 0.5) - elif state.search_screen == 'addressbook': - self.root.ids.sc11.children[2].children[1].ids.search_field.text = '' - self.root.ids.sc11.children[1].active = True - Clock.schedule_once(self.search_callback, 0.5) - elif state.search_screen == 'myaddress': - try: - self.root.ids.sc10.children[3].children[1].ids.search_field.text = '' - except Exception: - self.root.ids.sc10.children[2].children[1].ids.search_field.text = '' - self.root.ids.sc10.children[1].active = True - Clock.schedule_once(self.search_callback, 0.5) - else: - self.root.ids.sc4.children[2].children[1].ids.search_field.text = '' - self.root.ids.sc4.children[1].active = True - Clock.schedule_once(self.search_callback, 0.5) - return + def refreshScreen(self): # pylint: disable=unused-variable + """Method show search button only on inbox or sent screen.""" + state.searcing_text = '' + if state.search_screen == 'inbox': + try: + self.root.ids.sc1.children[ + 3].children[1].ids.search_field.text = '' + except Exception: + self.root.ids.sc1.children[ + 2].children[1].ids.search_field.text = '' + self.root.ids.sc1.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) + elif state.search_screen == 'addressbook': + self.root.ids.sc11.children[ + 2].children[1].ids.search_field.text = '' + self.root.ids.sc11.children[ + 1].active = True + Clock.schedule_once(self.search_callback, 0.5) + elif state.search_screen == 'myaddress': + try: + self.root.ids.sc10.children[ + 3].children[1].ids.search_field.text = '' + except Exception: + self.root.ids.sc10.children[ + 2].children[1].ids.search_field.text = '' + self.root.ids.sc10.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) + else: + self.root.ids.sc4.children[ + 2].children[1].ids.search_field.text = '' + self.root.ids.sc4.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) + return def set_identicon(self, text): """This method is use for showing identicon in address spinner""" @@ -1605,7 +1605,8 @@ class GrashofPopup(Popup): folder="addressbook")] stored_labels = [labels[0] for labels in kivy_helper_search.search_sql( folder="addressbook")] - if label and address and address not in stored_address and label not in stored_labels: + if label and address and address not in stored_address \ + and label not in stored_labels: # state.navinstance = self.parent.children[1] queues.UISignalQueue.put(('rerenderAddressBook', '')) self.dismiss() @@ -1664,8 +1665,7 @@ class GrashofPopup(Popup): def checkLabel_valid(self, instance): """Checking address label is unique of not""" entered_label = instance.text.strip() - addr_labels = [labels[0] - for labels in kivy_helper_search.search_sql( + addr_labels = [labels[0] for labels in kivy_helper_search.search_sql( folder="addressbook")] if entered_label in addr_labels: self.ids.label.error = True @@ -1679,26 +1679,22 @@ class GrashofPopup(Popup): class AvatarSampleWidget(ILeftBody, Image): """Avatar Sample Widget.""" - pass class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton): """Left icon sample widget.""" - pass class IconRightSampleWidget(IRightBodyTouch, MDCheckbox): """Right icon sample widget.""" - pass class NavigationDrawerTwoLineListItem( TwoLineListItem, NavigationDrawerHeaderBase): """Navigation Drawer in Listitems.""" - address_property = StringProperty() def __init__(self, **kwargs): @@ -1723,7 +1719,6 @@ class NavigationDrawerTwoLineListItem( class MailDetail(Screen): """MailDetail Screen uses to show the detail of mails.""" - to_addr = StringProperty() from_addr = StringProperty() subject = StringProperty() @@ -1798,7 +1793,8 @@ class MailDetail(Screen): self.parent.screens[15].clear_widgets() self.parent.screens[15].add_widget(Draft()) - self.parent.current = 'allmails' if state.is_allmail else state.detailPageType + self.parent.current = 'allmails' \ + if state.is_allmail else state.detailPageType if state.detailPageType != 'draft': msg_count_objs.trash_cnt.badge_text = str( int(state.trash_count) + 1) @@ -1859,7 +1855,6 @@ class MailDetail(Screen): class MyaddDetailPopup(Popup): """MyaddDetailPopup pop is used for showing my address detail.""" - address_label = StringProperty() address = StringProperty() @@ -1893,7 +1888,6 @@ class MyaddDetailPopup(Popup): class AddbookDetailPopup(Popup): """AddbookDetailPopup pop is used for showing my address detail.""" - address_label = StringProperty() address = StringProperty() @@ -1948,7 +1942,8 @@ class AddbookDetailPopup(Popup): address_list = kivy_helper_search.search_sql(folder="addressbook") addr_labels = [labels[0] for labels in address_list] add_dict = dict(address_list) - if self.address and entered_label in addr_labels and self.address != add_dict[entered_label]: + if self.address and entered_label in addr_labels \ + and self.address != add_dict[entered_label]: self.ids.add_label.error = True self.ids.add_label.helper_text = 'label name already exists.' elif entered_label: @@ -1973,7 +1968,6 @@ class ShowQRCode(Screen): class Draft(Screen): """Draft screen is used to show the list of draft messages.""" - data = ListProperty() queryreturn = ListProperty() has_refreshed = True @@ -2117,16 +2111,17 @@ class Draft(Screen): sendMessageToPeople = True if sendMessageToPeople: from addresses import decodeAddress - status, addressVersionNumber, streamNumber, ripe = decodeAddress( - toAddress) + # status, addressVersionNumber, streamNumber, ripe = decodeAddress( + # toAddress) + streamNumber, ripe = decodeAddress(toAddress)[2:] from addresses import addBMIfNotPresent toAddress = addBMIfNotPresent(toAddress) - statusIconColor = 'red' + # statusIconColor = 'red' stealthLevel = BMConfigParser().safeGetInt( 'bitmessagesettings', 'ackstealthlevel') from helper_ackPayload import genAckPayload ackdata = genAckPayload(streamNumber, stealthLevel) - t = () + # t = () sqlExecute( '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', @@ -2165,7 +2160,6 @@ class CustomSpinner(Spinner): class Allmails(Screen): """all mails Screen uses screen to show widgets of screens.""" - data = ListProperty() has_refreshed = True all_mails = ListProperty() @@ -2197,8 +2191,9 @@ class Allmails(Screen): " message, folder, msgid As id, DATE(received) As actionTime" " FROM inbox WHERE folder = 'inbox' ORDER BY actionTime DESC") if self.all_mails: - state.kivyapp.root.children[2].children[0].ids.allmail_cnt.badge_text = str( - len(self.all_mails)) + state.kivyapp.root.children[2].children[ + 0].ids.allmail_cnt.badge_text = str( + len(self.all_mails)) state.all_count = str(len(self.all_mails)) self.set_mdlist(0, 20) self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) @@ -2277,7 +2272,7 @@ class Allmails(Screen): src_mng_obj.current = 'mailDetail' def swipe_delete(self, unique_id, folder, instance, *args): - """Delete inbox mail from all mail listing listing.""" + """Delete inbox mail from all mail listing.""" if folder == 'inbox': sqlExecute( "UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str( @@ -2320,7 +2315,8 @@ class Allmails(Screen): # pylint: disable=attribute-defined-outside-init def refresh_callback(self, *args): - """Method updates the state of application, While the spinner remains on the screen.""" + """Method updates the state of application, + While the spinner remains on the screen.""" def refresh_callback(interval): """Method used for loading the allmails screen data.""" self.ids.ml.clear_widgets() @@ -2338,42 +2334,38 @@ class Allmails(Screen): """Setting root layout""" try: return self.manager.parent.parent - except Exception as e: + except Exception: return state.kivyapp.root.ids.float_box def avatarImageFirstLetter(letter_string): - """This method is used to the first letter for the avatar image""" + """This function is used to the first letter for the avatar image""" if letter_string[0].upper() >= 'A' and letter_string[0].upper() <= 'Z': img_latter = letter_string[0].upper() elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9: img_latter = letter_string[0] else: img_latter = '!' - return img_latter class Starred(Screen): """Starred Screen show widgets of page.""" - pass class Archieve(Screen): """Archieve Screen show widgets of page.""" - pass class Spam(Screen): """Spam Screen show widgets of page.""" - pass class LoadingPopup(Popup): - """Load Popup""" + """Class for loading Popup""" def __init__(self, **kwargs): super(LoadingPopup, self).__init__(**kwargs) @@ -2381,5 +2373,5 @@ class LoadingPopup(Popup): Clock.schedule_once(self.dismiss_popup, 0.5) def dismiss_popup(self, dt): - """Dismissing popup""" + """Dismiss popups""" self.dismiss() From 43d63006250b9fe3625b786189f7f4742b94a7ee Mon Sep 17 00:00:00 2001 From: navjot Date: Tue, 26 Nov 2019 18:49:44 +0530 Subject: [PATCH 10/22] worked on trash message permanent delete functionlity --- src/bitmessagekivy/main.kv | 3 + src/bitmessagekivy/mpybit.py | 159 ++++++++++++++++++++++------------- src/class_singleCleaner.py | 13 ++- 3 files changed, 116 insertions(+), 59 deletions(-) diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 5547de61..81586f2f 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -74,6 +74,7 @@ text: "Starred" icon:'star' on_release: app.root.ids.scr_mngr.current = 'starred' + badge_text: "0" NavigationDrawerIconButton: icon: 'archive' text: "Archieve" @@ -231,6 +232,7 @@ NavigationLayout: do_scroll_x: False MDList: id: ml + Loader: ComposerButton: : @@ -984,6 +986,7 @@ NavigationLayout: orientation: 'vertical' size_hint_y: None height: dp(100) + self.minimum_height + Loader: : id: cpyButton diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 6413c448..ad20147d 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -106,6 +106,7 @@ class Inbox(Screen): """Load Inbox list for Inbox messages.""" # pylint: disable=too-many-locals if state.searcing_text: + self.children[2].children[0].children[0].scroll_y = 1.0 where = ['subject', 'message'] what = state.searcing_text xAddress = 'toaddress' @@ -295,6 +296,7 @@ class MyAddress(Screen): # pylint: disable=unnecessary-lambda, deprecated-lambda self.addresses_list = state.kivyapp.variable_1 if state.searcing_text: + self.ids.refresh_layout.scroll_y = 1.0 filtered_list = filter( lambda addr: self.filter_address( addr), BMConfigParser().addresses()) @@ -413,6 +415,7 @@ class AddressBook(Screen): def loadAddresslist(self, account, where="", what=""): """Clock Schdule for method AddressBook.""" if state.searcing_text: + self.ids.scroll_y.scroll_y = 1.0 where = ['label', 'address'] what = state.searcing_text xAddress = '' @@ -477,7 +480,7 @@ class AddressBook(Screen): def update_addressBook_on_scroll(self, exist_addresses): """This method is used to load more data on scroll down""" - self.set_mdList(exist_addresses, exist_addresses + 20) + self.set_mdList(exist_addresses,exist_addresses + 5) @staticmethod def refreshs(*args): @@ -622,8 +625,6 @@ class DropDownWidget(BoxLayout): BMConfigParser().getint( 'bitmessagesettings', 'ttl')) state.check_sent_acc = fromAddress - # state.msg_counter_objs = self.parent.parent.parent.parent\ - # .parent.parent.children[0].children[2].children[0].ids state.msg_counter_objs = self.parent.parent.parent.parent\ .parent.parent.children[2].children[0].ids # self.parent.parent.screens[0].ids.ml.clear_widgets() @@ -631,9 +632,7 @@ class DropDownWidget(BoxLayout): self.parent.parent.screens[3].update_sent_messagelist() self.parent.parent.screens[16].clear_widgets() self.parent.parent.screens[16].add_widget(Allmails()) - # toast('sending...') Clock.schedule_once(self.callback_for_msgsend, 3) - # toLabel = '' queues.workerQueue.put(('sendmessage', toAddress)) print "sqlExecute successfully #######################" state.in_composer = True @@ -869,6 +868,7 @@ class Sent(Screen): def loadSent(self, account, where="", what=""): """Load Sent list for Sent messages.""" if state.searcing_text: + self.ids.scroll_y.scroll_y = 1.0 where = ['subject', 'message'] what = state.searcing_text xAddress = 'fromaddress' @@ -1057,6 +1057,8 @@ class Trash(Screen): """Trash Screen uses screen to show widgets of screens.""" trash_messages = ListProperty() has_refreshed = True + delete_index = StringProperty() + table_name = StringProperty() def __init__(self, *args, **kwargs): """Trash method, delete sent message and add in Trash.""" @@ -1069,11 +1071,10 @@ class Trash(Screen): if BMConfigParser().addresses(): state.association = BMConfigParser().addresses()[0] self.trash_messages = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder, ackdata" - " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" - " folder = 'trash' UNION SELECT toaddress, fromaddress, subject," - " message, folder, msgid As id, DATE(received) As actionTime FROM" - " inbox WHERE folder = 'trash' ORDER BY actionTime DESC") + "SELECT toaddress, fromaddress, subject, message, folder ||',' || 'sent' as folder, ackdata As id, DATE(lastactiontime)" + " As actionTime FROM sent WHERE folder = 'trash' and fromaddress = '{0}' UNION" + " SELECT toaddress, fromaddress, subject, message, folder ||',' || 'inbox' as folder, msgid As id, DATE(received) As" + " actionTime FROM inbox WHERE folder = 'trash' and toaddress = '{0}' ORDER BY actionTime DESC".format(state.association)) if self.trash_messages: src_mng_obj = state.kivyapp.root.children[2].children[0].ids src_mng_obj.trash_cnt.badge_text = str(len(self.trash_messages)) @@ -1115,7 +1116,7 @@ class Trash(Screen): del_btn.background_normal = '' del_btn.background_color = (1, 0, 0, 1) del_btn.bind(on_press=partial( - self.delete_permanently, item[5])) + self.delete_permanently, item[5], item[4])) carousel.add_widget(del_btn) carousel.add_widget(meny) carousel.index = 1 @@ -1137,9 +1138,49 @@ class Trash(Screen): """This method is used to load more data on scroll down""" self.set_mdList(total_trash_msg, total_trash_msg + 5) - def delete_permanently(self, data_index, instance, *args): + def delete_permanently(self, data_index, folder, instance, *args): """Deleting trash mail permanently.""" - pass + self.table_name = folder.split(',')[1] + self.delete_index = data_index + self.delete_confirmation() + + def callback_for_screen_load(self, dt=0): + """This methos is for loading screen""" + self.ids.ml.clear_widgets() + self.init_ui(0) + self.children[1].active = False + toast('Message is permanently deleted') + + def delete_confirmation(self): + """This method is used to show delete confirmation popup""" + delete_msg_dialog = MDDialog( + text='Are you sure you want to delete this message permanently from trash?', + title='', size_hint=(.8, .25), text_button_ok='Yes', + text_button_cancel='No', events_callback=self.callback_for_delete_msg) + delete_msg_dialog.open() + + def callback_for_delete_msg(self, text_item): + """Method is used for getting the callback of alert box""" + if text_item == 'Yes': + self.delete_message_from_trash() + else: + toast(text_item) + + def delete_message_from_trash(self): + """This method is used to delete """ + self.children[1].active = True + if self.table_name == 'inbox': + sqlExecute("DELETE FROM inbox WHERE msgid = ?;", str( + self.delete_index)) + elif self.table_name == 'sent': + sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str( + self.delete_index)) + msg_count_objs = state.kivyapp.root.children[2].children[0].ids + if int(state.trash_count) > 0: + msg_count_objs.trash_cnt.badge_text = str( + int(state.trash_count) - 1) + state.trash_count = str(int(state.trash_count) - 1) + Clock.schedule_once(self.callback_for_screen_load, 1) class Page(Screen): @@ -1520,39 +1561,39 @@ class NavigateApp(App): self.refreshScreen() state.in_search_mode = False - def refreshScreen(self): # pylint: disable=unused-variable - """Method show search button only on inbox or sent screen.""" - state.searcing_text = '' - if state.search_screen == 'inbox': - try: - self.root.ids.sc1.children[ - 3].children[1].ids.search_field.text = '' - except Exception: - self.root.ids.sc1.children[ - 2].children[1].ids.search_field.text = '' - self.root.ids.sc1.children[1].active = True - Clock.schedule_once(self.search_callback, 0.5) - elif state.search_screen == 'addressbook': - self.root.ids.sc11.children[ + def refreshScreen(self): # pylint: disable=unused-variable + """Method show search button only on inbox or sent screen.""" + state.searcing_text = '' + if state.search_screen == 'inbox': + try: + self.root.ids.sc1.children[ + 3].children[1].ids.search_field.text = '' + except Exception: + self.root.ids.sc1.children[ 2].children[1].ids.search_field.text = '' - self.root.ids.sc11.children[ - 1].active = True - Clock.schedule_once(self.search_callback, 0.5) - elif state.search_screen == 'myaddress': - try: - self.root.ids.sc10.children[ - 3].children[1].ids.search_field.text = '' - except Exception: - self.root.ids.sc10.children[ - 2].children[1].ids.search_field.text = '' - self.root.ids.sc10.children[1].active = True - Clock.schedule_once(self.search_callback, 0.5) - else: - self.root.ids.sc4.children[ + self.root.ids.sc1.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) + elif state.search_screen == 'addressbook': + self.root.ids.sc11.children[ + 2].children[1].ids.search_field.text = '' + self.root.ids.sc11.children[ + 1].active = True + Clock.schedule_once(self.search_callback, 0.5) + elif state.search_screen == 'myaddress': + try: + self.root.ids.sc10.children[ + 3].children[1].ids.search_field.text = '' + except Exception: + self.root.ids.sc10.children[ 2].children[1].ids.search_field.text = '' - self.root.ids.sc4.children[1].active = True - Clock.schedule_once(self.search_callback, 0.5) - return + self.root.ids.sc10.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) + else: + self.root.ids.sc4.children[ + 2].children[1].ids.search_field.text = '' + self.root.ids.sc4.children[1].active = True + Clock.schedule_once(self.search_callback, 0.5) + return def set_identicon(self, text): """This method is use for showing identicon in address spinner""" @@ -1768,6 +1809,7 @@ class MailDetail(Screen): msg_count_objs = state.kivyapp.root.children[2].children[0].ids state.searcing_text = '' if state.detailPageType == 'sent': + state.kivyapp.root.ids.sc4.children[2].children[1].ids.search_field.text = '' sqlExecute( "UPDATE sent SET folder = 'trash' WHERE" " ackdata = ?;", str(state.mail_id)) @@ -1776,6 +1818,8 @@ class MailDetail(Screen): self.parent.screens[3].ids.ml.clear_widgets() self.parent.screens[3].loadSent(state.association) elif state.detailPageType == 'inbox': + state.kivyapp.root.ids.sc1.children[2].children[1].ids.search_field.text = '' + self.parent.screens[0].children[2].children[1].ids.search_field.text = '' sqlExecute( "UPDATE inbox SET folder = 'trash' WHERE" " msgid = ?;", str(state.mail_id)) @@ -1784,6 +1828,7 @@ class MailDetail(Screen): state.inbox_count = str(int(state.inbox_count) - 1) self.parent.screens[0].ids.ml.clear_widgets() self.parent.screens[0].loadMessagelist(state.association) + elif state.detailPageType == 'draft': sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str( state.mail_id)) @@ -1793,8 +1838,8 @@ class MailDetail(Screen): self.parent.screens[15].clear_widgets() self.parent.screens[15].add_widget(Draft()) - self.parent.current = 'allmails' \ - if state.is_allmail else state.detailPageType + # self.parent.current = 'allmails' \ + # if state.is_allmail else state.detailPageType if state.detailPageType != 'draft': msg_count_objs.trash_cnt.badge_text = str( int(state.trash_count) + 1) @@ -1806,7 +1851,15 @@ class MailDetail(Screen): self.parent.screens[4].add_widget(Trash()) self.parent.screens[16].clear_widgets() self.parent.screens[16].add_widget(Allmails()) - state.kivyapp.back_press() + self.children[0].children[0].active = True + Clock.schedule_once(self.callback_for_delete, 3) + + def callback_for_delete(self, dt=0): + 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') def inbox_reply(self): @@ -1824,10 +1877,6 @@ class MailDetail(Screen): self.parent.current = 'create' state.kivyapp.set_navbar_for_composer() - def copy_sent_mail(self): - """Method used for copying sent mail to the composer.""" - pass - def write_msg(self, navApp): """Method used to write on draft mail.""" state.send_draft_mail = state.mail_id @@ -2111,17 +2160,13 @@ class Draft(Screen): sendMessageToPeople = True if sendMessageToPeople: from addresses import decodeAddress - # status, addressVersionNumber, streamNumber, ripe = decodeAddress( - # toAddress) streamNumber, ripe = decodeAddress(toAddress)[2:] from addresses import addBMIfNotPresent 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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', @@ -2187,9 +2232,9 @@ class Allmails(Screen): self.all_mails = sqlQuery( "SELECT toaddress, fromaddress, subject, message, folder, ackdata" " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" - " folder = 'sent' UNION SELECT toaddress, fromaddress, subject," + " folder = 'sent' and fromaddress = '{0}' UNION SELECT toaddress, fromaddress, subject," " message, folder, msgid As id, DATE(received) As actionTime" - " FROM inbox WHERE folder = 'inbox' ORDER BY actionTime DESC") + " FROM inbox WHERE folder = 'inbox' and toaddress = '{0}' ORDER BY actionTime DESC".format(account)) if self.all_mails: state.kivyapp.root.children[2].children[ 0].ids.allmail_cnt.badge_text = str( diff --git a/src/class_singleCleaner.py b/src/class_singleCleaner.py index 9a2916c7..2556f813 100644 --- a/src/class_singleCleaner.py +++ b/src/class_singleCleaner.py @@ -30,11 +30,11 @@ from helper_threading import StoppableThread from inventory import Inventory from network.connectionpool import BMConnectionPool from debug import logger +from datetime import datetime, timedelta import knownnodes import queues import state - class singleCleaner(StoppableThread): """Base method that Cleanup knownnodes and handle possible severe exception""" name = "singleCleaner" @@ -111,7 +111,7 @@ class singleCleaner(StoppableThread): resendPubkeyRequest(toAddress) elif status == 'msgsent': resendMsg(ackData) - + deleteTrashMsgPermonantly() try: # Cleanup knownnodes and handle possible severe exception # while writing it to disk @@ -202,3 +202,12 @@ def resendMsg(ackdata): 'updateStatusBar', 'Doing work necessary to again attempt to deliver a message...' )) + + +def deleteTrashMsgPermonantly(): + """This method is used to delete old messages""" + ndays_before_time = datetime.now() - timedelta(days=30) + old_messages = time.mktime(ndays_before_time.timetuple()) + sqlExecute("delete from sent where folder = 'trash' and lastactiontime <= ?;", int(old_messages)) + sqlExecute("delete from inbox where folder = 'trash' and received <= ?;", int(old_messages)) + return From 3053239a1b29b675c094545085b2aa84ba9d98d6 Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 29 Nov 2019 20:27:39 +0530 Subject: [PATCH 11/22] worked on suggestion text functionality on address creation --- src/bitmessagekivy/main.kv | 34 +++++++++++++++++++--------------- src/bitmessagekivy/mpybit.py | 31 ++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 81586f2f..1c2e3c6a 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -15,6 +15,7 @@ #:import Factory kivy.factory.Factory #:import MDScrollViewRefreshLayout kivymd.refreshlayout.MDScrollViewRefreshLayout #:import MDSpinner kivymd.spinner.MDSpinner +#:import NoTransition kivy.uix.screenmanager.NoTransition #:set color_button (0.784, 0.443, 0.216, 1) # brown #:set color_button_pressed (0.659, 0.522, 0.431, 1) # darker brown @@ -58,6 +59,7 @@ text: "Inbox" on_release: app.root.ids.scr_mngr.current = 'inbox' badge_text: "0" + on_press: app.load_screen(self) NavigationDrawerIconButton: id: send_cnt icon: 'send' @@ -70,21 +72,21 @@ text: "Draft" on_release: app.root.ids.scr_mngr.current = 'draft' badge_text: "0" - NavigationDrawerIconButton: - text: "Starred" - icon:'star' - on_release: app.root.ids.scr_mngr.current = 'starred' - badge_text: "0" - NavigationDrawerIconButton: - icon: 'archive' - text: "Archieve" - on_release: app.root.ids.scr_mngr.current = 'archieve' - badge_text: "0" - NavigationDrawerIconButton: - icon: 'email-open-outline' - text: "Spam" - on_release: app.root.ids.scr_mngr.current = 'spam' - badge_text: "0" + #NavigationDrawerIconButton: + #text: "Starred" + #icon:'star' + #on_release: app.root.ids.scr_mngr.current = 'starred' + #badge_text: "0" + #NavigationDrawerIconButton: + #icon: 'archive' + #text: "Archieve" + #on_release: app.root.ids.scr_mngr.current = 'archieve' + #badge_text: "0" + #NavigationDrawerIconButton: + #icon: 'email-open-outline' + #text: "Spam" + #on_release: app.root.ids.scr_mngr.current = 'spam' + #badge_text: "0" NavigationDrawerIconButton: id: trash_cnt icon: 'delete' @@ -196,6 +198,7 @@ NavigationLayout: : name: 'inbox' + transition: NoTransition() BoxLayout: orientation: 'vertical' spacing: dp(10) @@ -478,6 +481,7 @@ NavigationLayout: size_hint: .5, .35 height: dp(40) on_press: app.root.ids.scr_mngr.current = 'random' + on_press: app.root.ids.sc7.reset_address_label() MDLabel: font_style: 'Title' text: 'proceed' diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index ad20147d..2cce497d 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -834,13 +834,16 @@ class Random(Screen): for obj in BMConfigParser().addresses()] if entered_label in lables: self.ids.label.error = True - self.ids.label.helper_text = 'Label name is already exist' + self.ids.label.helper_text = 'Label name is already exist you can try this Ex. ( {0}_1, {0}_2 )'.format(entered_label) elif entered_label: self.ids.label.error = False else: self.ids.label.error = False self.ids.label.helper_text = 'This field is required' + def reset_address_label(self): + self.ids.label.text = '' + class Sent(Screen): """Sent Screen uses screen to show widgets of screens.""" @@ -1621,6 +1624,20 @@ class NavigateApp(App): delete_btn] toolbar_obj.right_action_items = dynamic_list + def load_screen(self, instance): + """This method is used for loading screen on every click""" + if instance.text == 'Inbox': + self.root.ids.scr_mngr.current = 'inbox' + self.root.ids.sc1.children[1].active = True + self.root.ids.sc1.ids.ml.clear_widgets() + Clock.schedule_once(partial(self.load_screen_callback, instance), 0.5) + + def load_screen_callback(self, instance, dt=0): + """This method is rotating loader for few seconds""" + if instance.text == 'Inbox': + self.root.ids.sc1.loadMessagelist(state.association) + self.root.ids.sc1.children[1].active = False + class GrashofPopup(Popup): """Methods for saving contacts, error messages.""" @@ -1808,6 +1825,7 @@ class MailDetail(Screen): """Method for mail delete.""" msg_count_objs = state.kivyapp.root.children[2].children[0].ids state.searcing_text = '' + self.children[0].children[0].active = True if state.detailPageType == 'sent': state.kivyapp.root.ids.sc4.children[2].children[1].ids.search_field.text = '' sqlExecute( @@ -1847,12 +1865,11 @@ class MailDetail(Screen): int(state.all_count) - 1) state.trash_count = str(int(state.trash_count) + 1) state.all_count = str(int(state.all_count) - 1) - self.parent.screens[4].clear_widgets() - self.parent.screens[4].add_widget(Trash()) - self.parent.screens[16].clear_widgets() - self.parent.screens[16].add_widget(Allmails()) - self.children[0].children[0].active = True - Clock.schedule_once(self.callback_for_delete, 3) + self.parent.screens[4].ids.ml.clear_widgets() + self.parent.screens[4].init_ui(dt=0) + self.parent.screens[16].ids.ml.clear_widgets() + self.parent.screens[16].init_ui(dt=0) + Clock.schedule_once(self.callback_for_delete, 4) def callback_for_delete(self, dt=0): self.children[0].children[0].active = False From b90c9da0a419dfa6c919a3080364a0ca4f345df8 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Thu, 28 Nov 2019 20:20:00 +0530 Subject: [PATCH 12/22] mpybit fixes --- src/bitmessagekivy/mpybit.py | 47 ++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 2cce497d..2d54516f 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -480,7 +480,7 @@ class AddressBook(Screen): def update_addressBook_on_scroll(self, exist_addresses): """This method is used to load more data on scroll down""" - self.set_mdList(exist_addresses,exist_addresses + 5) + self.set_mdList(exist_addresses, exist_addresses + 5) @staticmethod def refreshs(*args): @@ -1074,10 +1074,15 @@ class Trash(Screen): if BMConfigParser().addresses(): state.association = BMConfigParser().addresses()[0] self.trash_messages = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder ||',' || 'sent' as folder, ackdata As id, DATE(lastactiontime)" - " As actionTime FROM sent WHERE folder = 'trash' and fromaddress = '{0}' UNION" - " SELECT toaddress, fromaddress, subject, message, folder ||',' || 'inbox' as folder, msgid As id, DATE(received) As" - " actionTime FROM inbox WHERE folder = 'trash' and toaddress = '{0}' ORDER BY actionTime DESC".format(state.association)) + "SELECT toaddress, fromaddress, subject, message," + " folder ||',' || 'sent' as folder, ackdata As id," + " DATE(lastactiontime) As actionTime FROM sent" + " WHERE folder = 'trash' and fromaddress = '{0}' UNION" + " SELECT toaddress, fromaddress, subject, message," + " folder ||',' || 'inbox' as folder, msgid As id," + " DATE(received) As actionTime FROM inbox WHERE" + " folder = 'trash' and toaddress = '{0}'" + " ORDER BY actionTime DESC".format(state.association)) if self.trash_messages: src_mng_obj = state.kivyapp.root.children[2].children[0].ids src_mng_obj.trash_cnt.badge_text = str(len(self.trash_messages)) @@ -1157,9 +1162,13 @@ class Trash(Screen): def delete_confirmation(self): """This method is used to show delete confirmation popup""" delete_msg_dialog = MDDialog( - text='Are you sure you want to delete this message permanently from trash?', - title='', size_hint=(.8, .25), text_button_ok='Yes', - text_button_cancel='No', events_callback=self.callback_for_delete_msg) + text='Are you sure you want to delete this' / + ' message permanently from trash?', + title='', + size_hint=(.8, .25), + text_button_ok='Yes', + text_button_cancel='No', + events_callback=self.callback_for_delete_msg) delete_msg_dialog.open() def callback_for_delete_msg(self, text_item): @@ -1181,7 +1190,7 @@ class Trash(Screen): msg_count_objs = state.kivyapp.root.children[2].children[0].ids if int(state.trash_count) > 0: msg_count_objs.trash_cnt.badge_text = str( - int(state.trash_count) - 1) + int(state.trash_count) - 1) state.trash_count = str(int(state.trash_count) - 1) Clock.schedule_once(self.callback_for_screen_load, 1) @@ -1827,7 +1836,8 @@ class MailDetail(Screen): state.searcing_text = '' self.children[0].children[0].active = True if state.detailPageType == 'sent': - state.kivyapp.root.ids.sc4.children[2].children[1].ids.search_field.text = '' + state.kivyapp.root.ids.sc4.children[ + 2].children[1].ids.search_field.text = '' sqlExecute( "UPDATE sent SET folder = 'trash' WHERE" " ackdata = ?;", str(state.mail_id)) @@ -1836,8 +1846,10 @@ class MailDetail(Screen): self.parent.screens[3].ids.ml.clear_widgets() self.parent.screens[3].loadSent(state.association) elif state.detailPageType == 'inbox': - state.kivyapp.root.ids.sc1.children[2].children[1].ids.search_field.text = '' - self.parent.screens[0].children[2].children[1].ids.search_field.text = '' + state.kivyapp.root.ids.sc1.children[ + 2].children[1].ids.search_field.text = '' + self.parent.screens[0].children[2].children[ + 1].ids.search_field.text = '' sqlExecute( "UPDATE inbox SET folder = 'trash' WHERE" " msgid = ?;", str(state.mail_id)) @@ -1846,7 +1858,7 @@ class MailDetail(Screen): state.inbox_count = str(int(state.inbox_count) - 1) self.parent.screens[0].ids.ml.clear_widgets() self.parent.screens[0].loadMessagelist(state.association) - + elif state.detailPageType == 'draft': sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str( state.mail_id)) @@ -1872,6 +1884,7 @@ class MailDetail(Screen): Clock.schedule_once(self.callback_for_delete, 4) def callback_for_delete(self, dt=0): + """Delete method from allmails""" self.children[0].children[0].active = False state.kivyapp.set_common_header() self.parent.current = 'allmails' \ @@ -2249,9 +2262,11 @@ class Allmails(Screen): self.all_mails = sqlQuery( "SELECT toaddress, fromaddress, subject, message, folder, ackdata" " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" - " folder = 'sent' and fromaddress = '{0}' UNION SELECT toaddress, fromaddress, subject," - " message, folder, msgid As id, DATE(received) As actionTime" - " FROM inbox WHERE folder = 'inbox' and toaddress = '{0}' ORDER BY actionTime DESC".format(account)) + " folder = 'sent' and fromaddress = '{0}' UNION SELECT toaddress," + " fromaddress, subject, message, folder, msgid As id," + " DATE(received) As actionTime FROM inbox WHERE" + " folder = 'inbox' and toaddress = '{0}'" + " ORDER BY actionTime DESC".format(account)) if self.all_mails: state.kivyapp.root.children[2].children[ 0].ids.allmail_cnt.badge_text = str( From e0536e7497a58bbefe5fc16868e97e6a290107eb Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Fri, 29 Nov 2019 17:42:38 +0530 Subject: [PATCH 13/22] docstring and formatting mpybit --- src/bitmessagekivy/mpybit.py | 412 +++++++++++++++++------------------ 1 file changed, 202 insertions(+), 210 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 2d54516f..1a8dabac 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1,12 +1,12 @@ """ -Bitmessage kivy interface +Bitmessage android(mobile) interface """ # pylint: disable=relative-import, import-error, no-name-in-module # pylint: disable=too-few-public-methods, too-many-lines, unused-argument import os import time -from functools import partial from bmconfigparser import BMConfigParser +from functools import partial from helper_sql import sqlExecute, sqlQuery from kivy.app import App from kivy.clock import Clock @@ -65,7 +65,7 @@ import identiconGeneration def toast(text): - """Function displays toast message.""" + """Function displays toast message""" # pylint: disable=redefined-outer-name from kivymd.toast.kivytoast import toast toast(text) @@ -73,19 +73,19 @@ def toast(text): class Navigatorss(MDNavigationDrawer): - """Navigator class contains image, title and logo.""" + """Navigator class (image, title and logo)""" image_source = StringProperty('images/qidenticon_two.png') title = StringProperty('Navigation') drawer_logo = StringProperty() class Inbox(Screen): - """Inbox Screen uses screen to show widgets of screens.""" + """Inbox Screen uses screen to show widgets of screens""" queryreturn = ListProperty() has_refreshed = True def __init__(self, *args, **kwargs): - """Method Parsing the address.""" + """Method Parsing the address""" super(Inbox, self).__init__(*args, **kwargs) if state.association == '': if BMConfigParser().addresses(): @@ -93,17 +93,17 @@ class Inbox(Screen): Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method inbox accounts.""" + """Clock schdule for method inbox accounts""" self.inboxaccounts() print dt def inboxaccounts(self): - """Load inbox accounts.""" + """Load all inbox accounts""" account = state.association self.loadMessagelist(account, 'All', '') def loadMessagelist(self, account, where="", what=""): - """Load Inbox list for Inbox messages.""" + """Load inbox list for inbox messages""" # pylint: disable=too-many-locals if state.searcing_text: self.children[2].children[0].children[0].scroll_y = 1.0 @@ -149,11 +149,14 @@ class Inbox(Screen): secondary_text=item['secondary_text'], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) - meny.add_widget(AvatarSampleWidget( - source='./images/text_images/{}.png'.format( - avatarImageFirstLetter(item['secondary_text'].strip())))) - meny.bind(on_press=partial( - self.inbox_detail, item['msgid'])) + meny.add_widget( + AvatarSampleWidget( + source='./images/text_images/{}.png'.format( + avatarImageFirstLetter( + item['secondary_text'].strip())))) + meny.bind( + on_press=partial( + self.inbox_detail, item['msgid'])) carousel = Carousel(direction='right') carousel.height = meny.height carousel.size_hint_y = None @@ -163,14 +166,16 @@ class Inbox(Screen): 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, item['msgid'])) + del_btn.bind( + on_press=partial( + self.delete, item['msgid'])) carousel.add_widget(del_btn) carousel.add_widget(meny) ach_btn = Button(text='Achieve') ach_btn.background_color = (0, 1, 0, 1) - ach_btn.bind(on_press=partial( - self.archive, item['msgid'])) + ach_btn.bind( + on_press=partial( + self.archive, item['msgid'])) carousel.add_widget(ach_btn) carousel.index = 1 self.ids.ml.add_widget(carousel) @@ -192,7 +197,6 @@ class Inbox(Screen): """This method is used to load more data on scroll down""" data = [] for mail in self.queryreturn[total_message:total_message + 5]: - # third_text = mail[3].replace('\n', ' ') data.append({ 'text': mail[4].strip(), 'secondary_text': mail[5][:50] + '........' if len( @@ -202,7 +206,7 @@ class Inbox(Screen): self.set_mdList(data) def inbox_detail(self, msg_id, *args): - """Load inbox page details.""" + """Load inbox page details""" state.detailPageType = 'inbox' state.mail_id = msg_id if self.manager: @@ -214,7 +218,7 @@ class Inbox(Screen): src_mng_obj.current = 'mailDetail' def delete(self, data_index, instance, *args): - """Delete inbox mail from inbox listing.""" + """Delete inbox mail from inbox listing""" sqlExecute( "UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str( data_index)) @@ -244,7 +248,7 @@ class Inbox(Screen): self.update_trash() def archive(self, data_index, instance, *args): - """Archive inbox mail from inbox listing.""" + """Archive inbox mail from inbox listing""" sqlExecute( "UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str( data_index)) @@ -252,7 +256,7 @@ class Inbox(Screen): self.update_trash() def update_trash(self): - """Update trash screen mails which is deleted from inbox.""" + """Update trash screen mails which is deleted from inbox""" try: self.parent.screens[4].clear_widgets() self.parent.screens[4].add_widget(Trash()) @@ -263,9 +267,9 @@ class Inbox(Screen): # pylint: disable=attribute-defined-outside-init def refresh_callback(self, *args): """Method updates the state of application, - While the spinner remains on the screen.""" + While the spinner remains on the screen""" def refresh_callback(interval): - """Method used for loading the inbox screen data.""" + """Method used for loading the inbox screen data""" state.searcing_text = '' self.children[2].children[1].ids.search_field.text = '' self.ids.ml.clear_widgets() @@ -282,17 +286,17 @@ class Inbox(Screen): class MyAddress(Screen): - """MyAddress Screen uses screen to show widgets of screens.""" + """MyAddress screen uses screen to show widgets of screens""" addresses_list = ListProperty() has_refreshed = True def __init__(self, *args, **kwargs): - """Clock Schdule for method inbox accounts.""" + """Clock schdule for method inbox accounts""" super(MyAddress, self).__init__(*args, **kwargs) Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method inbox accounts.""" + """Clock schdule for method inbox accounts""" # pylint: disable=unnecessary-lambda, deprecated-lambda self.addresses_list = state.kivyapp.variable_1 if state.searcing_text: @@ -324,7 +328,7 @@ class MyAddress(Screen): pass def set_mdList(self, first_index, last_index): - """This method is used to create the mdlist""" + """Creating the mdlist""" data = [] for address in self.addresses_list[first_index:last_index]: data.append({ @@ -344,7 +348,7 @@ class MyAddress(Screen): self.ids.ml.add_widget(meny) def check_scroll_y(self, instance, somethingelse): - """This method is used to load data on scroll""" + """Load data on scroll down""" if self.ids.refresh_layout.scroll_y <= -0.0 and self.has_refreshed: self.ids.refresh_layout.scroll_y = 0.06 my_addresses = len(self.ids.ml.children) @@ -356,12 +360,12 @@ class MyAddress(Screen): pass def update_addressBook_on_scroll(self, my_addresses): - """This method is used to load more data on scroll down""" + """Loads more data on scroll down""" self.set_mdList(my_addresses, my_addresses + 20) @staticmethod def myadd_detail(fromaddress, label, *args): - """Myaddress Details.""" + """Load myaddresses details""" p = MyaddDetailPopup() p.open() p.set_address(fromaddress, label) @@ -369,9 +373,9 @@ class MyAddress(Screen): # pylint: disable=attribute-defined-outside-init def refresh_callback(self, *args): """Method updates the state of application, - While the spinner remains on the screen.""" + While the spinner remains on the screen""" def refresh_callback(interval): - """Method used for loading the myaddress screen data.""" + """Method used for loading the myaddress screen data""" state.searcing_text = '' state.kivyapp.root.ids.sc10.children[2].active = False self.children[2].children[1].ids.search_field.text = '' @@ -384,11 +388,11 @@ class MyAddress(Screen): @staticmethod def filter_address(address): - """Method will filter the my address list data.""" - # pylint: disable=deprecated-lambda - if filter(lambda x: (state.searcing_text).lower() in x, [ - BMConfigParser().get( - address, 'label').lower(), address.lower()]): + """Method will filter the my address list data""" + # if filter(lambda x: (state.searcing_text).lower() in x, [ + # BMConfigParser().get( + # address, 'label').lower(), address.lower()]): + if [x for x in [BMConfigParser().get(address, 'label').lower(), address.lower()]]: return True return False @@ -398,22 +402,22 @@ class MyAddress(Screen): class AddressBook(Screen): - """AddressBook Screen uses screen to show widgets of screens.""" + """AddressBook Screen uses screen to show widgets of screens""" queryreturn = ListProperty() has_refreshed = True def __init__(self, *args, **kwargs): - """Getting AddressBook Details.""" + """Getting AddressBook Details""" super(AddressBook, self).__init__(*args, **kwargs) Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method AddressBook.""" + """Clock Schdule for method AddressBook""" self.loadAddresslist(None, 'All', '') print dt def loadAddresslist(self, account, where="", what=""): - """Clock Schdule for method AddressBook.""" + """Clock Schdule for method AddressBook""" if state.searcing_text: self.ids.scroll_y.scroll_y = 1.0 where = ['label', 'address'] @@ -439,7 +443,7 @@ class AddressBook(Screen): self.ids.ml.add_widget(content) def set_mdList(self, start_index, end_index): - """This method is used to create the mdList""" + """Creating the mdList""" for item in self.queryreturn[start_index:end_index]: meny = TwoLineAvatarIconListItem( text=item[0], @@ -467,7 +471,7 @@ class AddressBook(Screen): self.ids.ml.add_widget(carousel) def check_scroll_y(self, instance, somethingelse): - """This method is used to load data on scroll""" + """Load data on scroll""" if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: self.ids.scroll_y.scroll_y = 0.06 exist_addresses = len(self.ids.ml.children) @@ -479,25 +483,25 @@ class AddressBook(Screen): pass def update_addressBook_on_scroll(self, exist_addresses): - """This method is used to load more data on scroll down""" + """Load more data on scroll down""" self.set_mdList(exist_addresses, exist_addresses + 5) @staticmethod def refreshs(*args): - """Refresh the Widget.""" + """Refresh the Widget""" # state.navinstance.ids.sc11.ids.ml.clear_widgets() # state.navinstance.ids.sc11.loadAddresslist(None, 'All', '') pass @staticmethod def addBook_detail(address, label, *args): - """Addressbook Details.""" + """Addressbook details""" p = AddbookDetailPopup() p.open() p.set_addbook_data(address, label) def delete_address(self, address, instance, *args): - """Delete inbox mail from inbox listing.""" + """Delete inbox mail from inbox listing""" self.ids.ml.remove_widget(instance.parent.parent) sqlExecute( "DELETE FROM addressbook WHERE address = '{}';".format(address)) @@ -505,34 +509,33 @@ class AddressBook(Screen): class SelectableRecycleBoxLayout( FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout): - """Adds selection and focus behaviour to the view.""" + """Adds selection and focus behaviour to the view""" # pylint: disable = too-many-ancestors - pass class SelectableLabel(RecycleDataViewBehavior, Label): - """Add selection support to the Label.""" + """Add selection support to the Label""" index = None selected = BooleanProperty(False) selectable = BooleanProperty(True) def refresh_view_attrs(self, rv, index, data): - """Catch and handle the view changes.""" + """Catch and handle the view changes""" self.index = index return super(SelectableLabel, self).refresh_view_attrs( rv, index, data) # pylint: disable=inconsistent-return-statements def on_touch_down(self, touch): - """Add selection on touch down.""" + """Add selection on touch down""" if super(SelectableLabel, self).on_touch_down(touch): return True if self.collide_point(*touch.pos) and self.selectable: return self.parent.select_with_touch(self.index, touch) def apply_selection(self, rv, index, is_selected): - """Respond to the selection of items in the view.""" + """Respond to the selection of items in the view""" self.selected = is_selected if is_selected: print "selection changed to {0}".format(rv.data[index]) @@ -541,23 +544,22 @@ class SelectableLabel(RecycleDataViewBehavior, Label): class RV(RecycleView): - """Recycling View.""" + """Recycling View""" - def __init__(self, **kwargs): - """Recycling Method.""" - # pylint: disable=useless-super-delegation + def __init__(self, **kwargs): # pylint: disable=useless-super-delegation + """Recycling Method""" super(RV, self).__init__(**kwargs) class DropDownWidget(BoxLayout): - """Adding Dropdown Widget.""" + """Adding Dropdown Widget""" # pylint: disable=too-many-statements, too-many-locals # pylint: disable=inconsistent-return-statements txt_input = ObjectProperty() rv = ObjectProperty() def send(self, navApp): - """Send message from one address to another.""" + """Send message from one address to another""" fromAddress = str(self.ids.ti.text) toAddress = str(self.ids.txt_input.text) subject = self.ids.subject.text.encode('utf-8').strip() @@ -655,7 +657,7 @@ class DropDownWidget(BoxLayout): # pylint: disable=attribute-defined-outside-init def address_error_message(self, msg): - """Show Error Message.""" + """Generates error message""" msg_dialog = MDDialog( text=msg, title='', size_hint=(.8, .25), text_button_ok='Ok', @@ -664,11 +666,11 @@ class DropDownWidget(BoxLayout): @staticmethod def callback_for_menu_items(text_item): - """Method is used for getting the callback of alert box""" + """Callback of alert box""" toast(text_item) def reset_composer(self): - """Method will reset composer.""" + """Method will reset composer""" self.ids.ti.text = '' self.ids.btn.text = 'Select' self.ids.txt_input.text = '' @@ -677,26 +679,25 @@ class DropDownWidget(BoxLayout): toast("Reset message") def auto_fill_fromaddr(self): - """Mehtod used to fill the text automatically From Address.""" + """Fill the text automatically From Address""" self.ids.ti.text = self.ids.btn.text self.ids.ti.focus = True class MyTextInput(TextInput): - """Takes the text input in the field.""" + """Takes the text input in the field""" txt_input = ObjectProperty() flt_list = ObjectProperty() word_list = ListProperty() starting_no = NumericProperty(3) suggestion_text = '' - def __init__(self, **kwargs): - """Getting Text Input.""" - # pylint: disable=useless-super-delegation + def __init__(self, **kwargs): # pylint: disable=useless-super-delegation + """Getting Text Input""" super(MyTextInput, self).__init__(**kwargs) def on_text(self, instance, value): - """Find all the occurrence of the word.""" + """Find all the occurrence of the word""" self.parent.parent.parent.parent.ids.rv.data = [] matches = [self.word_list[i] for i in range( len(self.word_list)) if self.word_list[ @@ -711,7 +712,7 @@ class MyTextInput(TextInput): self.parent.height = 400 def keyboard_on_key_down(self, window, keycode, text, modifiers): - """Key Down.""" + """Key Down""" if self.suggestion_text and keycode[1] == 'tab': self.insert_text(self.suggestion_text + ' ') return True @@ -720,11 +721,10 @@ class MyTextInput(TextInput): class Payment(Screen): - """Payment Method.""" + """Payment module""" - def get_available_credits(self, instance): - """Method helps to get the available credits""" - # pylint: disable=no-self-use + def get_available_credits(self, instance): # pylint: disable=no-self-use + """Get the available credits""" state.availabe_credit = instance.parent.children[1].text existing_credits = ( state.kivyapp.root.ids.sc18.ids.ml.children[0].children[ @@ -741,17 +741,17 @@ class Payment(Screen): class Credits(Screen): - """Credits Method""" + """Credits Module""" available_credits = StringProperty('{0}'.format('0')) class Login(Screen): - """Login Screeen.""" + """Login Screeen""" pass class NetworkStat(Screen): - """Method used to show network stat.""" + """Method used to show network stat""" text_variable_1 = StringProperty( '{0}::{1}'.format('Total Connections', '0')) text_variable_2 = StringProperty( @@ -763,12 +763,12 @@ class NetworkStat(Screen): 'Processed {0} object to be synced'.format('0')) def __init__(self, *args, **kwargs): - """Init method for network stat.""" + """Init method for network stat""" super(NetworkStat, self).__init__(*args, **kwargs) Clock.schedule_interval(self.init_ui, 1) def init_ui(self, dt=0): - """Clock Schdule for method inbox accounts.""" + """Clock Schdule for method inbox accounts""" import network.stats import shared from network import objectracker @@ -785,17 +785,17 @@ class NetworkStat(Screen): class ContentNavigationDrawer(Navigatorss): - """Navigate Content Drawer.""" + """Navigate Content Drawer""" pass class Random(Screen): - """Generates Random Address.""" + """Generates Random Address""" is_active = BooleanProperty(False) checked = StringProperty("") def generateaddress(self, navApp): - """Method for Address Generator.""" + """Method for Address Generator""" entered_label = str(self.ids.label.text).strip() streamNumberForAddress = 1 label = self.ids.label.text @@ -828,7 +828,7 @@ class Random(Screen): toast('New address created') def add_validation(self, instance): - """Checking validation at address creation time.""" + """Checking validation at address creation time""" entered_label = str(instance.text.strip()) lables = [BMConfigParser().get(obj, 'label') for obj in BMConfigParser().addresses()] @@ -846,12 +846,12 @@ class Random(Screen): class Sent(Screen): - """Sent Screen uses screen to show widgets of screens.""" + """Sent Screen uses screen to show widgets of screens""" queryreturn = ListProperty() has_refreshed = True def __init__(self, *args, **kwargs): - """Association with the screen.""" + """Association with the screen""" super(Sent, self).__init__(*args, **kwargs) if state.association == '': if BMConfigParser().addresses(): @@ -859,17 +859,17 @@ class Sent(Screen): Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method sent accounts.""" + """Clock Schdule for method sent accounts""" self.sentaccounts() print dt def sentaccounts(self): - """Load sent accounts.""" + """Load sent accounts""" account = state.association self.loadSent(account, 'All', '') def loadSent(self, account, where="", what=""): - """Load Sent list for Sent messages.""" + """Load Sent list for Sent messages""" if state.searcing_text: self.ids.scroll_y.scroll_y = 1.0 where = ['subject', 'message'] @@ -967,7 +967,7 @@ class Sent(Screen): self.set_mdlist(data, total_sent - 1) def check_scroll_y(self, instance, somethingelse): - """This method is used to load data on scroll""" + """Load data on scroll down""" if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: self.ids.scroll_y.scroll_y = 0.06 total_sent_msg = len(self.ids.ml.children) @@ -979,7 +979,7 @@ class Sent(Screen): pass def update_sent_screen_on_scroll(self, total_sent_msg): - """This method is used to load more data on scroll down""" + """Load more data on scroll down""" data = [] for mail in self.queryreturn[total_sent_msg:total_sent_msg + 5]: data.append({ @@ -998,7 +998,7 @@ class Sent(Screen): state.sent_count = str(total_sent) def sent_detail(self, ackdata, *args): - """Load sent mail details.""" + """Load sent mail details""" state.detailPageType = 'sent' state.mail_id = ackdata if self.manager: @@ -1010,7 +1010,7 @@ class Sent(Screen): src_mng_obj.current = 'mailDetail' def delete(self, data_index, instance, *args): - """Delete sent mail from sent mail listing.""" + """Delete sent mail from sent mail listing""" try: msg_count_objs = self.parent.parent.parent.parent.children[ 2].children[0].ids @@ -1035,7 +1035,7 @@ class Sent(Screen): self.update_trash() def archive(self, data_index, instance, *args): - """Archive sent mail from sent mail listing.""" + """Archive sent mail from sent mail listing""" sqlExecute( "UPDATE sent SET folder = 'trash'" " WHERE ackdata = ?;", str(data_index)) @@ -1043,7 +1043,7 @@ class Sent(Screen): self.update_trash() def update_trash(self): - """Update trash screen mails which is deleted from inbox.""" + """Update trash screen mails which is deleted from inbox""" try: self.parent.screens[4].clear_widgets() self.parent.screens[4].add_widget(Trash()) @@ -1057,19 +1057,19 @@ class Sent(Screen): class Trash(Screen): - """Trash Screen uses screen to show widgets of screens.""" + """Trash Screen uses screen to show widgets of screens""" trash_messages = ListProperty() has_refreshed = True delete_index = StringProperty() table_name = StringProperty() def __init__(self, *args, **kwargs): - """Trash method, delete sent message and add in Trash.""" + """Trash method, delete sent message and add in Trash""" super(Trash, self).__init__(*args, **kwargs) Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method inbox accounts.""" + """Clock Schdule for method inbox accounts""" if state.association == '': if BMConfigParser().addresses(): state.association = BMConfigParser().addresses()[0] @@ -1101,7 +1101,7 @@ class Trash(Screen): self.ids.ml.add_widget(content) def set_mdList(self, first_index, last_index): - """This method is used to create the mdlist""" + """Creating the mdlist""" for item in self.trash_messages[first_index:last_index]: meny = TwoLineAvatarIconListItem( text=item[1], @@ -1131,7 +1131,7 @@ class Trash(Screen): self.ids.ml.add_widget(carousel) def check_scroll_y(self, instance, somethingelse): - """This method is used to load data on scroll""" + """Load data on scroll""" if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: self.ids.scroll_y.scroll_y = 0.06 total_trash_msg = len(self.ids.ml.children) @@ -1143,11 +1143,11 @@ class Trash(Screen): pass def update_trash_screen_on_scroll(self, total_trash_msg): - """This method is used to load more data on scroll down""" + """Load more data on scroll down""" self.set_mdList(total_trash_msg, total_trash_msg + 5) def delete_permanently(self, data_index, folder, instance, *args): - """Deleting trash mail permanently.""" + """Deleting trash mail permanently""" self.table_name = folder.split(',')[1] self.delete_index = data_index self.delete_confirmation() @@ -1160,7 +1160,7 @@ class Trash(Screen): toast('Message is permanently deleted') def delete_confirmation(self): - """This method is used to show delete confirmation popup""" + """Show confirmation delete popup""" delete_msg_dialog = MDDialog( text='Are you sure you want to delete this' / ' message permanently from trash?', @@ -1172,14 +1172,14 @@ class Trash(Screen): delete_msg_dialog.open() def callback_for_delete_msg(self, text_item): - """Method is used for getting the callback of alert box""" + """Getting the callback of alert box""" if text_item == 'Yes': self.delete_message_from_trash() else: toast(text_item) def delete_message_from_trash(self): - """This method is used to delete """ + """Deleting message from trash""" self.children[1].active = True if self.table_name == 'inbox': sqlExecute("DELETE FROM inbox WHERE msgid = ?;", str( @@ -1196,16 +1196,14 @@ class Trash(Screen): class Page(Screen): - """Page Screen show widgets of page.""" - + """Page Screen show widgets of page""" pass class Create(Screen): - """Creates the screen widgets.""" - + """Creates the screen widgets""" def __init__(self, **kwargs): - """Getting Labels and address from addressbook.""" + """Getting Labels and address from addressbook""" super(Create, self).__init__(**kwargs) widget_1 = DropDownWidget() widget_1.ids.txt_input.word_list = [ @@ -1216,14 +1214,12 @@ class Create(Screen): class Setting(Screen): - """Setting the Screen components.""" - + """Setting the Screen components""" pass -class NavigateApp(App): - """Navigation Layout of class.""" - # pylint: disable=too-many-public-methods +class NavigateApp(App): # pylint: disable=too-many-public-methods + """Navigation Layout of class""" theme_cls = ThemeManager() previous_date = ObjectProperty() obj_1 = ObjectProperty() @@ -1252,7 +1248,7 @@ class NavigateApp(App): ] def build(self): - """Method builds the widget.""" + """Method builds the widget""" main_widget = Builder.load_file( os.path.join(os.path.dirname(__file__), 'main.kv')) self.nav_drawer = Navigatorss() @@ -1264,14 +1260,14 @@ class NavigateApp(App): return main_widget def run(self): - """Running the widgets.""" + """Running the widgets""" kivyuisignaler.release() super(NavigateApp, self).run() # pylint: disable=inconsistent-return-statements @staticmethod def showmeaddresses(name="text"): - """Show the addresses in spinner to make as dropdown.""" + """Show the addresses in spinner to make as dropdown""" if name == "text": if BMConfigParser().addresses(): return BMConfigParser().addresses()[0][:16] + '..' @@ -1283,7 +1279,7 @@ class NavigateApp(App): return "valuesdemo" def getCurrentAccountData(self, text): - """Get Current Address Account Data.""" + """Get Current Address Account Data""" self.set_identicon(text) address_label = self.current_address_label( BMConfigParser().get(text, 'label'), text) @@ -1338,19 +1334,19 @@ class NavigateApp(App): @staticmethod def getCurrentAccount(): - """It uses to get current account label.""" + """It uses to get current account label""" if state.association: return state.association return "Bitmessage Login" @staticmethod def addingtoaddressbook(): - """Adding to address Book.""" + """Adding to address Book""" p = GrashofPopup() p.open() def getDefaultAccData(self): - """Getting Default Account Data.""" + """Getting Default Account Data""" if BMConfigParser().addresses(): img = identiconGeneration.generate(BMConfigParser().addresses()[0]) self.createFolder('./images/default_identicon/') @@ -1370,7 +1366,7 @@ class NavigateApp(App): @staticmethod def createFolder(directory): - """This method is used to create the directory when app starts""" + """Create directory when app starts""" try: if not os.path.exists(directory): os.makedirs(directory) @@ -1387,13 +1383,13 @@ class NavigateApp(App): @staticmethod def addressexist(): - """Checking address existence.""" + """Checking address existence""" if BMConfigParser().addresses(): return True return False def on_key(self, window, key, *args): - """Method is used for going on previous screen.""" + """Method is used for going on previous screen""" if key == 27: if state.in_search_mode and self.root.ids.scr_mngr.current != ( "mailDetail"): @@ -1432,7 +1428,7 @@ class NavigateApp(App): Clock.schedule_once(self.search_callback, 0.5) def search_callback(self, dt=0): - """This method is used to show data after loader is loaded""" + """Show data after loader is loaded""" if state.search_screen == 'inbox': self.root.ids.sc1.ids.ml.clear_widgets() self.root.ids.sc1.loadMessagelist(state.association) @@ -1462,19 +1458,19 @@ class NavigateApp(App): return def reset(self, *args): - """Method used to set transition direction.""" + """Set transition direction""" self.root.ids.scr_mngr.transition.direction = 'left' self.root.ids.scr_mngr.transition.unbind(on_complete=self.reset) @staticmethod def status_dispatching(data): - """Method used for status dispatching acknowledgment.""" + """Dispatching Status acknowledgment""" ackData, message = data if state.ackdata == ackData: state.status.status = message def clear_composer(self): - """If slow down the nwe will make new composer edit screen.""" + """If slow down, the new composer edit screen""" self.set_navbar_for_composer() composer_obj = self.root.ids.sc3.children[1].ids composer_obj.ti.text = '' @@ -1486,7 +1482,7 @@ class NavigateApp(App): state.in_sent_method = False def set_navbar_for_composer(self): - """This method is used for clearing toolbar data when composer open""" + """Clearing toolbar data when composer open""" self.root.ids.toolbar.left_action_items = [ ['arrow-left', lambda x: self.back_press()]] self.root.ids.toolbar.right_action_items = [ @@ -1496,7 +1492,7 @@ class NavigateApp(App): lambda x: self.root.ids.sc3.children[1].send(self)]] def set_common_header(self): - """Common for all window""" + """Common header for all window""" self.root.ids.toolbar.right_action_items = [ ['account-plus', lambda x: self.addingtoaddressbook()]] self.root.ids.toolbar.left_action_items = [ @@ -1504,10 +1500,10 @@ class NavigateApp(App): return def back_press(self): - """Method used for going back from composer to previous page.""" + """Method for, reverting composer to previous page""" self.save_draft() - if self.root.ids.scr_mngr.current == 'mailDetail' \ - and state.in_search_mode: + if self.root.ids.scr_mngr.current == \ + 'mailDetail' and state.in_search_mode: toolbar_obj = self.root.ids.toolbar toolbar_obj.left_action_items = [ ['arrow-left', lambda x: self.closeSearchScreen()]] @@ -1528,14 +1524,14 @@ class NavigateApp(App): @staticmethod def on_stop(): - """On stop methos is used for stoping the runing script.""" + """On stop methos is used for stoping the runing script""" print "*******************EXITING FROM APPLICATION*******************" import shutdown shutdown.doCleanShutdown() @staticmethod def current_address_label(current_add_label=None, current_addr=None): - """Getting current address labels.""" + """Getting current address labels""" if BMConfigParser().addresses(): if current_add_label: first_name = current_add_label @@ -1551,7 +1547,7 @@ class NavigateApp(App): return '' def searchQuery(self, instance): - """Method used for showing searched mails.""" + """Showing searched mails""" state.search_screen = self.root.ids.scr_mngr.current state.searcing_text = str(instance.text).strip() if instance.focus and state.searcing_text: @@ -1563,7 +1559,7 @@ class NavigateApp(App): state.in_search_mode = True def closeSearchScreen(self): - """Function for close search screen""" + """Function for close search screen""" self.set_common_header() address_label = self.current_address_label( BMConfigParser().get( @@ -1574,7 +1570,7 @@ class NavigateApp(App): state.in_search_mode = False def refreshScreen(self): # pylint: disable=unused-variable - """Method show search button only on inbox or sent screen.""" + """Method show search button only on inbox or sent screen""" state.searcing_text = '' if state.search_screen == 'inbox': try: @@ -1608,13 +1604,13 @@ class NavigateApp(App): return def set_identicon(self, text): - """This method is use for showing identicon in address spinner""" + """Show identicon in address spinner""" img = identiconGeneration.generate(text) self.root.children[2].children[0].ids.btn.children[1].texture = ( img.texture) def set_mail_detail_header(self): - """Method is used for setting the details of the page""" + """Setting the details of the page""" toolbar_obj = self.root.ids.toolbar toolbar_obj.left_action_items = [ ['arrow-left', lambda x: self.back_press()]] @@ -1649,15 +1645,14 @@ class NavigateApp(App): class GrashofPopup(Popup): - """Methods for saving contacts, error messages.""" + """Moule for save contacts and error messages""" - def __init__(self, **kwargs): - """Grash of pop screen settings.""" - # pylint: disable=useless-super-delegation + def __init__(self, **kwargs): # pylint: disable=useless-super-delegation + """Grash of pop screen settings""" super(GrashofPopup, self).__init__(**kwargs) def savecontact(self): - """Method is used for Saving Contacts.""" + """Method is used for saving contacts""" label = self.ids.label.text.strip() address = self.ids.address.text.strip() if label == '' and address == '': @@ -1685,7 +1680,7 @@ class GrashofPopup(Popup): # pylint: disable=attribute-defined-outside-init def show_error_message(self): - """Showing error message.""" + """Showing error message""" content = MDLabel( font_style='Body1', theme_text_color='Secondary', @@ -1705,7 +1700,7 @@ class GrashofPopup(Popup): @staticmethod def close_pop(): - """Pop is Canceled.""" + """Pop is Canceled""" toast('Canceled') def checkAddress_valid(self, instance): @@ -1730,7 +1725,7 @@ class GrashofPopup(Popup): self.ids.address.helper_text = 'This field is required' def checkLabel_valid(self, instance): - """Checking address label is unique of not""" + """Checking address label is unique or not""" entered_label = instance.text.strip() addr_labels = [labels[0] for labels in kivy_helper_search.search_sql( folder="addressbook")] @@ -1745,36 +1740,36 @@ class GrashofPopup(Popup): class AvatarSampleWidget(ILeftBody, Image): - """Avatar Sample Widget.""" + """Avatar Sample Widget""" pass class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton): - """Left icon sample widget.""" + """Left icon sample widget""" pass class IconRightSampleWidget(IRightBodyTouch, MDCheckbox): - """Right icon sample widget.""" + """Right icon sample widget""" pass class NavigationDrawerTwoLineListItem( TwoLineListItem, NavigationDrawerHeaderBase): - """Navigation Drawer in Listitems.""" + """Navigation Drawer in Listitems""" address_property = StringProperty() def __init__(self, **kwargs): - """Method for Navigation Drawer.""" + """Method for Navigation Drawer""" super(NavigationDrawerTwoLineListItem, self).__init__(**kwargs) Clock.schedule_once(lambda dt: self.setup()) def setup(self): - """Bind Controller.current_account property.""" + """Bind Controller.current_account property""" pass def on_current_account(self, account): - """Account detail.""" + """Account detail""" pass def _update_specific_text_color(self, instance, value): @@ -1785,7 +1780,7 @@ class NavigationDrawerTwoLineListItem( class MailDetail(Screen): - """MailDetail Screen uses to show the detail of mails.""" + """MailDetail Screen uses to show the detail of mails""" to_addr = StringProperty() from_addr = StringProperty() subject = StringProperty() @@ -1794,12 +1789,12 @@ class MailDetail(Screen): page_type = StringProperty() def __init__(self, *args, **kwargs): - """Mail Details method.""" + """Mail Details method""" super(MailDetail, self).__init__(*args, **kwargs) Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method MailDetail mails.""" + """Clock Schdule for method MailDetail mails""" self.page_type = state.detailPageType if state.detailPageType else '' if state.detailPageType == 'sent' or state.detailPageType == 'draft': data = sqlQuery( @@ -1817,7 +1812,7 @@ class MailDetail(Screen): state.kivyapp.set_mail_detail_header() def assign_mail_details(self, data): - """Assigning mail details.""" + """Assigning mail details""" self.to_addr = data[0][0] self.from_addr = data[0][1] self.subject = data[0][2].upper( @@ -1831,7 +1826,7 @@ class MailDetail(Screen): 'message': self.message} def delete_mail(self): - """Method for mail delete.""" + """Method for mail delete""" msg_count_objs = state.kivyapp.root.children[2].children[0].ids state.searcing_text = '' self.children[0].children[0].active = True @@ -1893,7 +1888,7 @@ class MailDetail(Screen): toast('Deleted') def inbox_reply(self): - """Method used for replying inbox messages.""" + """Reply inbox messages""" data = sqlQuery( "select toaddress, fromaddress, subject, message from inbox where" " msgid = ?;", str(state.mail_id)) @@ -1908,7 +1903,7 @@ class MailDetail(Screen): state.kivyapp.set_navbar_for_composer() def write_msg(self, navApp): - """Method used to write on draft mail.""" + """Write on draft mail""" state.send_draft_mail = state.mail_id composer_ids = ( self.parent.parent.parent.parent.parent.ids.sc3.children[1].ids) @@ -1923,7 +1918,7 @@ class MailDetail(Screen): @staticmethod def copy_composer_text(instance, *args): - """This method is used for copying the data from mail detail page""" + """Copy the data from mail detail page""" if len(instance.parent.text.split(':')) > 1: cpy_text = instance.parent.text.split(':')[1].strip() else: @@ -1933,22 +1928,21 @@ class MailDetail(Screen): class MyaddDetailPopup(Popup): - """MyaddDetailPopup pop is used for showing my address detail.""" + """MyaddDetailPopup pop is used for showing my address detail""" address_label = StringProperty() address = StringProperty() - def __init__(self, **kwargs): - """My Address Details screen setting.""" - # pylint: disable=useless-super-delegation + def __init__(self, **kwargs): # pylint: disable=useless-super-delegation + """My Address Details screen setting""" super(MyaddDetailPopup, self).__init__(**kwargs) def set_address(self, address, label): - """Getting address for displaying details on popup.""" + """Getting address for displaying details on popup""" self.address_label = label self.address = address def send_message_from(self): - """Method used to fill from address of composer autofield.""" + """Method used to fill from address of composer autofield""" state.kivyapp.set_navbar_for_composer() window_obj = self.parent.children[1].ids window_obj.sc3.children[1].ids.ti.text = self.address @@ -1961,27 +1955,27 @@ class MyaddDetailPopup(Popup): @staticmethod def close_pop(): - """Pop is Canceled.""" + """Pop is Canceled""" toast('Canceled') class AddbookDetailPopup(Popup): - """AddbookDetailPopup pop is used for showing my address detail.""" + """AddbookDetailPopup pop is used for showing my address detail""" address_label = StringProperty() address = StringProperty() def __init__(self, **kwargs): - """Method used set screen of address detail page.""" + """Set screen of address detail page""" # pylint: disable=useless-super-delegation super(AddbookDetailPopup, self).__init__(**kwargs) def set_addbook_data(self, address, label): - """Getting address book data for detial dipaly.""" + """Getting address book data for detial dipaly""" self.address_label = label self.address = address def update_addbook_label(self, address): - """Updating the label of address book address.""" + """Updating the label of address book address""" address_list = kivy_helper_search.search_sql(folder="addressbook") stored_labels = [labels[0] for labels in address_list] add_dict = dict(address_list) @@ -1999,7 +1993,7 @@ class AddbookDetailPopup(Popup): toast('Saved') def send_message_to(self): - """Method used to fill to_address of composer autofield.""" + """Method used to fill to_address of composer autofield""" state.kivyapp.set_navbar_for_composer() window_obj = self.parent.children[1].ids window_obj.sc3.children[1].ids.txt_input.text = self.address @@ -2012,7 +2006,7 @@ class AddbookDetailPopup(Popup): @staticmethod def close_pop(): - """Pop is Canceled.""" + """Pop is Canceled""" toast('Canceled') def checkLabel_valid(self, instance): @@ -2033,10 +2027,10 @@ class AddbookDetailPopup(Popup): class ShowQRCode(Screen): - """ShowQRCode Screen uses to show the detail of mails.""" + """ShowQRCode Screen uses to show the detail of mails""" def qrdisplay(self): - """Method used for showing QR Code.""" + """Showing QR Code""" # self.manager.parent.parent.parent.ids.search_bar.clear_widgets() self.ids.qr.clear_widgets() from kivy.garden.qrcode import QRCodeWidget @@ -2046,13 +2040,13 @@ class ShowQRCode(Screen): class Draft(Screen): - """Draft screen is used to show the list of draft messages.""" + """Draft screen is used to show the list of draft messages""" data = ListProperty() queryreturn = ListProperty() has_refreshed = True def __init__(self, *args, **kwargs): - """Method used for storing draft messages.""" + """Method used for storing draft messages""" super(Draft, self).__init__(*args, **kwargs) if state.association == '': if BMConfigParser().addresses(): @@ -2060,17 +2054,17 @@ class Draft(Screen): Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method draft accounts.""" + """Clock Schdule for method draft accounts""" self.sentaccounts() print dt def sentaccounts(self): - """Load draft accounts.""" + """Load draft accounts""" account = state.association self.loadDraft(account, 'All', '') def loadDraft(self, account, where="", what=""): - """Load draft list for Draft messages.""" + """Load draft list for Draft messages""" xAddress = 'fromaddress' self.queryreturn = kivy_helper_search.search_sql( xAddress, account, "draft", where, what, False) @@ -2095,7 +2089,7 @@ class Draft(Screen): self.ids.ml.add_widget(content) def set_mdList(self, first_index, last_index): - """This method is used to create mdlist""" + """Create mdlist""" data = [] for mail in self.queryreturn[first_index:last_index]: third_text = mail[3].replace('\n', ' ') @@ -2133,7 +2127,7 @@ class Draft(Screen): self.ids.ml.add_widget(carousel) def check_scroll_y(self, instance, somethingelse): - """This method is used to load data on scroll""" + """Load data on scroll""" if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: self.ids.scroll_y.scroll_y = 0.06 total_draft_msg = len(self.ids.ml.children) @@ -2145,11 +2139,11 @@ class Draft(Screen): pass def update_draft_screen_on_scroll(self, total_draft_msg): - """This method is used to load more data on scroll down""" + """Load more data on scroll down""" self.set_mdList(total_draft_msg, total_draft_msg + 5) def draft_detail(self, ackdata, *args): - """Method used to show draft Details.""" + """Show draft Details""" state.detailPageType = 'draft' state.mail_id = ackdata if self.manager: @@ -2161,7 +2155,7 @@ class Draft(Screen): src_mng_obj.current = 'mailDetail' def delete_draft(self, data_index, instance, *args): - """Method used to delete draft message permanently.""" + """Delete draft message permanently""" sqlExecute("DELETE FROM sent WHERE ackdata = ?;", str( data_index)) try: @@ -2178,9 +2172,8 @@ class Draft(Screen): toast('Deleted') @staticmethod - def draft_msg(src_object): - """Method used for saving draft mails.""" - # pylint: disable=too-many-locals + def draft_msg(src_object): # pylint: disable=too-many-locals + """Save draft mails""" composer_object = state.kivyapp.root.ids.sc3.children[1].ids fromAddress = str(composer_object.ti.text) toAddress = str(composer_object.txt_input.text) @@ -2225,22 +2218,22 @@ class Draft(Screen): class CustomSpinner(Spinner): - """This class is used for setting spinner size.""" + """This class is used for setting spinner size""" def __init__(self, *args, **kwargs): - """Method used for setting size of spinner.""" + """Setting size of spinner""" super(CustomSpinner, self).__init__(*args, **kwargs) self.dropdown_cls.max_height = Window.size[1] / 3 class Allmails(Screen): - """all mails Screen uses screen to show widgets of screens.""" + """All mails Screen uses screen to show widgets of screens""" data = ListProperty() has_refreshed = True all_mails = ListProperty() def __init__(self, *args, **kwargs): - """Method Parsing the address.""" + """Method Parsing the address""" super(Allmails, self).__init__(*args, **kwargs) if state.association == '': if BMConfigParser().addresses(): @@ -2248,17 +2241,17 @@ class Allmails(Screen): Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method all mails.""" + """Clock Schdule for method all mails""" self.mailaccounts() print dt def mailaccounts(self): - """Load all mails for account.""" + """Load all mails for account""" account = state.association self.loadMessagelist(account, 'All', '') def loadMessagelist(self, account, where="", what=""): - """Load Inbox, Sent anf Draft list of messages.""" + """Load Inbox, Sent anf Draft list of messages""" self.all_mails = sqlQuery( "SELECT toaddress, fromaddress, subject, message, folder, ackdata" " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" @@ -2286,7 +2279,7 @@ class Allmails(Screen): self.ids.ml.add_widget(content) def set_mdlist(self, start_pnt, end_pnt): - """This method is used to create mdList for allmaills""" + """Create mdList for allmaills""" for item in self.all_mails[start_pnt:end_pnt]: meny = TwoLineAvatarIconListItem( text=item[1], @@ -2318,7 +2311,7 @@ class Allmails(Screen): self.ids.ml.add_widget(carousel) def check_scroll_y(self, instance, somethingelse): - """This method is used for scrolling on fixing length""" + """Scroll fixed length""" if self.ids.refresh_layout.scroll_y <= -0.00 and self.has_refreshed: self.ids.refresh_layout.scroll_y = .06 load_more = len(self.ids.ml.children) @@ -2327,8 +2320,7 @@ class Allmails(Screen): pass def updating_allmail(self, load_more): - """This method is used to update the all mail - listing value on the scroll of screen""" + """Update the all mail listing value on the scroll of screen""" if self.all_mails and load_more != len(self.all_mails): state.all_count = str(len(self.all_mails)) self.set_mdlist(load_more, load_more + 5) @@ -2336,7 +2328,7 @@ class Allmails(Screen): self.all_mails) else False def mail_detail(self, unique_id, folder, *args): - """Load sent and inbox mail details.""" + """Load sent and inbox mail details""" state.detailPageType = folder state.is_allmail = True state.mail_id = unique_id @@ -2349,7 +2341,7 @@ class Allmails(Screen): src_mng_obj.current = 'mailDetail' def swipe_delete(self, unique_id, folder, instance, *args): - """Delete inbox mail from all mail listing.""" + """Delete inbox mail from all mail listing""" if folder == 'inbox': sqlExecute( "UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", str( @@ -2393,9 +2385,9 @@ class Allmails(Screen): # pylint: disable=attribute-defined-outside-init def refresh_callback(self, *args): """Method updates the state of application, - While the spinner remains on the screen.""" + While the spinner remains on the screen""" def refresh_callback(interval): - """Method used for loading the allmails screen data.""" + """Load the allmails screen data""" self.ids.ml.clear_widgets() self.remove_widget(self.children[1]) try: @@ -2427,17 +2419,17 @@ def avatarImageFirstLetter(letter_string): class Starred(Screen): - """Starred Screen show widgets of page.""" + """Starred Screen show widgets of page""" pass class Archieve(Screen): - """Archieve Screen show widgets of page.""" + """Archieve Screen show widgets of page""" pass class Spam(Screen): - """Spam Screen show widgets of page.""" + """Spam Screen show widgets of page""" pass From 73f649b9a018d07b8d4cd7b229233db28c05126c Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Sat, 30 Nov 2019 19:23:41 +0530 Subject: [PATCH 14/22] fixes after pull --- src/bitmessagekivy/mpybit.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 1a8dabac..f14280ec 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -834,7 +834,9 @@ class Random(Screen): for obj in BMConfigParser().addresses()] if entered_label in lables: self.ids.label.error = True - self.ids.label.helper_text = 'Label name is already exist you can try this Ex. ( {0}_1, {0}_2 )'.format(entered_label) + self.ids.label.helper_text = 'Label name is already exist you'\ + ' can try this Ex. ( {0}_1, {0}_2 )'.format( + entered_label) elif entered_label: self.ids.label.error = False else: @@ -842,6 +844,7 @@ class Random(Screen): self.ids.label.helper_text = 'This field is required' def reset_address_label(self): + """Resetting address labels""" self.ids.label.text = '' @@ -1162,7 +1165,7 @@ class Trash(Screen): def delete_confirmation(self): """Show confirmation delete popup""" delete_msg_dialog = MDDialog( - text='Are you sure you want to delete this' / + text='Are you sure you want to delete this' ' message permanently from trash?', title='', size_hint=(.8, .25), From 3fc7414a609637259c7760e02ebc74fef6f7f4c1 Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 4 Dec 2019 21:15:45 +0530 Subject: [PATCH 15/22] worked on optimizing sql query for all screens --- src/bitmessagekivy/kivy_helper_search.py | 8 +- src/bitmessagekivy/mpybit.py | 355 +++++++++++++---------- 2 files changed, 203 insertions(+), 160 deletions(-) diff --git a/src/bitmessagekivy/kivy_helper_search.py b/src/bitmessagekivy/kivy_helper_search.py index 390d6fbd..829d4f00 100644 --- a/src/bitmessagekivy/kivy_helper_search.py +++ b/src/bitmessagekivy/kivy_helper_search.py @@ -4,7 +4,7 @@ Sql queries for bitmessagekivy from helper_sql import sqlQuery -def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, what=None, unreadOnly=False): +def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, what=None, unreadOnly=False, start_indx=0, end_indx=20): """Method helping for searching mails""" # pylint: disable=too-many-arguments, too-many-branches if what is not None and what != "": @@ -59,7 +59,9 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w if sqlStatementParts: sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts) if folder == "sent" or folder == "draft": - sqlStatementBase += " ORDER BY lastactiontime DESC" + sqlStatementBase += " ORDER BY lastactiontime DESC limit {0}, {1}".format(start_indx, end_indx) elif folder == "inbox": - sqlStatementBase += " ORDER BY received DESC" + sqlStatementBase += " ORDER BY received DESC limit {0}, {1}".format(start_indx, end_indx) + elif folder == "addressbook": + sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx) return sqlQuery(sqlStatementBase, sqlArguments) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index f14280ec..a2c10f0e 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -80,44 +80,43 @@ class Navigatorss(MDNavigationDrawer): class Inbox(Screen): - """Inbox Screen uses screen to show widgets of screens""" + """Inbox Screen uses screen to show widgets of screens.""" queryreturn = ListProperty() has_refreshed = True + account = StringProperty() def __init__(self, *args, **kwargs): - """Method Parsing the address""" + """Method Parsing the address.""" super(Inbox, self).__init__(*args, **kwargs) + Clock.schedule_once(self.init_ui, 0) + + def set_defaultAddress(self): + """This method set default address""" 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 inbox accounts""" - self.inboxaccounts() - print dt + """Clock schdule for method inbox accounts.""" + self.loadMessagelist() - def inboxaccounts(self): - """Load all inbox accounts""" - account = state.association - self.loadMessagelist(account, 'All', '') - - def loadMessagelist(self, account, where="", what=""): - """Load inbox list for inbox messages""" + def loadMessagelist(self, where="", what=""): + """Load Inbox list for Inbox messages.""" # pylint: disable=too-many-locals + self.set_defaultAddress() + self.account = state.association if state.searcing_text: self.children[2].children[0].children[0].scroll_y = 1.0 where = ['subject', 'message'] what = state.searcing_text xAddress = 'toaddress' data = [] - self.queryreturn = kivy_helper_search.search_sql( - xAddress, account, "inbox", where, what, False) + self.inboxDataQuery(xAddress, where, what) if self.queryreturn: + state.kivyapp.get_inbox_count() src_mng_obj = state.kivyapp.root.children[2].children[0].ids - src_mng_obj.inbox_cnt.badge_text = str(len(self.queryreturn)) - state.inbox_count = str(len(self.queryreturn)) - for mail in self.queryreturn[:20]: + src_mng_obj.inbox_cnt.badge_text = state.inbox_count + for mail in self.queryreturn: # third_text = mail[3].replace('\n', ' ') data.append({ 'text': mail[4].strip(), @@ -141,8 +140,14 @@ class Inbox(Screen): valign='top') self.ids.ml.add_widget(content) + def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20): + """This method used for retrieving inbox data""" + self.queryreturn = kivy_helper_search.search_sql( + xAddress, self.account, "inbox", where, what, False, start_indx, end_indx) + def set_mdList(self, data): """This method is used to create the mdList""" + total_message = len(self.ids.ml.children) for item in data: meny = TwoLineAvatarIconListItem( text=item['text'], @@ -179,6 +184,8 @@ class Inbox(Screen): carousel.add_widget(ach_btn) carousel.index = 1 self.ids.ml.add_widget(carousel) + update_message = len(self.ids.ml.children) + self.has_refreshed = True if total_message != update_message else False def check_scroll_y(self, instance, somethingelse): """This method is used to load data on scroll""" @@ -186,17 +193,19 @@ class Inbox(Screen): 0].scroll_y <= -0.0 and self.has_refreshed: self.children[2].children[0].children[0].scroll_y = 0.06 total_message = len(self.ids.ml.children) - if total_message != len(self.queryreturn): - self.update_inbox_screen_on_scroll(total_message) - self.has_refreshed = True if total_message != len( - self.queryreturn) else False + self.update_inbox_screen_on_scroll(total_message) else: pass - def update_inbox_screen_on_scroll(self, total_message): + def update_inbox_screen_on_scroll(self, total_message, where="", what=""): """This method is used to load more data on scroll down""" data = [] - for mail in self.queryreturn[total_message:total_message + 5]: + if state.searcing_text: + where = ['subject', 'message'] + what = state.searcing_text + self.inboxDataQuery('toaddress', where, what, total_message, 5) + for mail in self.queryreturn: + # third_text = mail[3].replace('\n', ' ') data.append({ 'text': mail[4].strip(), 'secondary_text': mail[5][:50] + '........' if len( @@ -286,17 +295,18 @@ class Inbox(Screen): class MyAddress(Screen): - """MyAddress screen uses screen to show widgets of screens""" + """MyAddress screen uses screen to show widgets of screens.""" addresses_list = ListProperty() has_refreshed = True + is_add_created = False def __init__(self, *args, **kwargs): - """Clock schdule for method inbox accounts""" + """Clock schdule for method Myaddress accounts.""" super(MyAddress, self).__init__(*args, **kwargs) Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock schdule for method inbox accounts""" + """Clock schdule for method Myaddress accounts""" # pylint: disable=unnecessary-lambda, deprecated-lambda self.addresses_list = state.kivyapp.variable_1 if state.searcing_text: @@ -321,7 +331,7 @@ class MyAddress(Screen): size_hint_y=None, valign='top') self.ids.ml.add_widget(content) - if not state.searcing_text: + if not state.searcing_text and not self.is_add_created: try: self.manager.current = 'login' except Exception: @@ -768,7 +778,7 @@ class NetworkStat(Screen): Clock.schedule_interval(self.init_ui, 1) def init_ui(self, dt=0): - """Clock Schdule for method inbox accounts""" + """Clock Schdule for method networkstat screen""" import network.stats import shared from network import objectracker @@ -823,8 +833,8 @@ class Random(Screen): """New address created""" state.kivyapp.root.ids.sc10.children[1].active = False state.kivyapp.root.ids.sc10.ids.ml.clear_widgets() + state.kivyapp.root.ids.sc10.is_add_created = True state.kivyapp.root.ids.sc10.init_ui() - self.manager.current = 'myaddress' toast('New address created') def add_validation(self, instance): @@ -852,9 +862,10 @@ class Sent(Screen): """Sent Screen uses screen to show widgets of screens""" queryreturn = ListProperty() has_refreshed = True + account = StringProperty() def __init__(self, *args, **kwargs): - """Association with the screen""" + """Association with the screen.""" super(Sent, self).__init__(*args, **kwargs) if state.association == '': if BMConfigParser().addresses(): @@ -867,32 +878,22 @@ class Sent(Screen): print dt def sentaccounts(self): - """Load sent accounts""" - account = state.association - self.loadSent(account, 'All', '') + """Load sent accounts.""" + self.account = state.association + self.loadSent() - def loadSent(self, account, where="", what=""): - """Load Sent list for Sent messages""" + def loadSent(self, where="", what=""): + """Load Sent list for Sent messages.""" if state.searcing_text: self.ids.scroll_y.scroll_y = 1.0 where = ['subject', 'message'] what = state.searcing_text xAddress = 'fromaddress' data = [] - self.queryreturn = kivy_helper_search.search_sql( - xAddress, account, "sent", where, what, False) - if state.msg_counter_objs and state.association == ( - state.check_sent_acc): - state.msg_counter_objs.send_cnt.badge_text = str( - len(self.queryreturn)) - state.sent_count = str(int(state.sent_count) + 1) - state.all_count = str(int(state.all_count) + 1) - state.msg_counter_objs.allmail_cnt.badge_text = state.all_count - state.check_sent_acc = None - + self.sentDataQuery(xAddress, where, what) if self.queryreturn: - self.set_sentCount(len(self.queryreturn)) - for mail in self.queryreturn[0:20]: + self.set_sentCount(state.sent_count) + for mail in self.queryreturn: data.append({ 'text': mail[1].strip(), 'secondary_text': mail[2][:50] + '........' if len( @@ -914,8 +915,14 @@ class Sent(Screen): valign='top') self.ids.ml.add_widget(content) - def set_mdlist(self, data, set_index): + def sentDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20): + """This method is used to retrieving data from sent table""" + self.queryreturn = kivy_helper_search.search_sql( + xAddress, self.account, "sent", where, what, False, start_indx, end_indx) + + def set_mdlist(self, data, set_index=0): """This method is used to create the mdList""" + total_sent_msg = len(self.ids.ml.children) for item in data: meny = TwoLineAvatarIconListItem( text=item['text'], @@ -947,20 +954,24 @@ class Sent(Screen): carousel.add_widget(ach_btn) carousel.index = 1 self.ids.ml.add_widget(carousel, index=set_index) + updated_msgs = len(self.ids.ml.children) + self.has_refreshed = True if total_sent_msg != updated_msgs else False def update_sent_messagelist(self): """This method is used to update screen when new mail is sent""" if len(self.ids.ml.children) < 3: + self.account = state.association self.ids.ml.clear_widgets() - self.loadSent(state.association) + self.loadSent() + total_sent = int(state.sent_count) + 1 + self.set_sentCount(total_sent) else: account = state.association data = [] - self.queryreturn = kivy_helper_search.search_sql( - 'fromaddress', account, "sent", '', '', False) - total_sent = len(self.queryreturn) + self.sentDataQuery('fromaddress', '', '', 0, 1) + total_sent = int(state.sent_count) + 1 self.set_sentCount(total_sent) - for mail in self.queryreturn[:1]: + for mail in self.queryreturn: data.append({ 'text': mail[1].strip(), 'secondary_text': mail[2][:50] + '........' if len( @@ -968,23 +979,29 @@ class Sent(Screen): '\n', ''))[0:50] + '........', 'ackdata': mail[5]}) self.set_mdlist(data, total_sent - 1) + if state.msg_counter_objs and state.association == ( + state.check_sent_acc): + state.all_count = str(int(state.all_count) + 1) + state.msg_counter_objs.allmail_cnt.badge_text = state.all_count + state.check_sent_acc = None def check_scroll_y(self, instance, somethingelse): """Load data on scroll down""" if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: self.ids.scroll_y.scroll_y = 0.06 total_sent_msg = len(self.ids.ml.children) - if total_sent_msg != len(self.queryreturn): - self.update_sent_screen_on_scroll(total_sent_msg) - self.has_refreshed = True if total_sent_msg != len( - self.queryreturn) else False + self.update_sent_screen_on_scroll(total_sent_msg) else: pass - def update_sent_screen_on_scroll(self, total_sent_msg): - """Load more data on scroll down""" + def update_sent_screen_on_scroll(self, total_sent_msg, where="", what=""): + """This method is used to load more data on scroll down""" + if state.searcing_text: + where = ['subject', 'message'] + what = state.searcing_text + self.sentDataQuery('fromaddress', where, what, total_sent_msg, 5) data = [] - for mail in self.queryreturn[total_sent_msg:total_sent_msg + 5]: + for mail in self.queryreturn: data.append({ 'text': mail[1].strip(), 'secondary_text': mail[2][:50] + '........' if len( @@ -1072,25 +1089,15 @@ class Trash(Screen): Clock.schedule_once(self.init_ui, 0) def init_ui(self, dt=0): - """Clock Schdule for method inbox accounts""" + """Clock Schdule for method trash screen.""" if state.association == '': if BMConfigParser().addresses(): state.association = BMConfigParser().addresses()[0] - self.trash_messages = sqlQuery( - "SELECT toaddress, fromaddress, subject, message," - " folder ||',' || 'sent' as folder, ackdata As id," - " DATE(lastactiontime) As actionTime FROM sent" - " WHERE folder = 'trash' and fromaddress = '{0}' UNION" - " SELECT toaddress, fromaddress, subject, message," - " folder ||',' || 'inbox' as folder, msgid As id," - " DATE(received) As actionTime FROM inbox WHERE" - " folder = 'trash' and toaddress = '{0}'" - " ORDER BY actionTime DESC".format(state.association)) + self.trashDataQuery(0, 20) if self.trash_messages: src_mng_obj = state.kivyapp.root.children[2].children[0].ids - src_mng_obj.trash_cnt.badge_text = str(len(self.trash_messages)) - state.trash_count = str(len(self.trash_messages)) - self.set_mdList(0, 20) + src_mng_obj.trash_cnt.badge_text = state.trash_count + self.set_mdList() self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( @@ -1103,9 +1110,17 @@ class Trash(Screen): valign='top') self.ids.ml.add_widget(content) - def set_mdList(self, first_index, last_index): - """Creating the mdlist""" - for item in self.trash_messages[first_index:last_index]: + def trashDataQuery(self, start_indx, end_indx): + self.trash_messages = sqlQuery( + "SELECT toaddress, fromaddress, subject, message, folder ||',' || 'sent' as folder, ackdata As id, DATE(lastactiontime)" + " As actionTime FROM sent WHERE folder = 'trash' and fromaddress = '{0}' UNION" + " SELECT toaddress, fromaddress, subject, message, folder ||',' || 'inbox' as folder, msgid As id, DATE(received) As" + " actionTime FROM inbox WHERE folder = 'trash' and toaddress = '{0}' ORDER BY actionTime DESC limit {1}, {2}".format(state.association, start_indx, end_indx)) + + def set_mdList(self): + """This method is used to create the mdlist""" + total_trash_msg = len(self.ids.ml.children) + for item in self.trash_messages: meny = TwoLineAvatarIconListItem( text=item[1], secondary_text=item[2][:50] + '........' if len( @@ -1132,22 +1147,22 @@ class Trash(Screen): carousel.add_widget(meny) carousel.index = 1 self.ids.ml.add_widget(carousel) + self.has_refreshed = True if total_trash_msg != len( + self.ids.ml.children) else False def check_scroll_y(self, instance, somethingelse): """Load data on scroll""" if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: self.ids.scroll_y.scroll_y = 0.06 total_trash_msg = len(self.ids.ml.children) - if total_trash_msg != len(self.trash_messages): - self.update_trash_screen_on_scroll(total_trash_msg) - self.has_refreshed = True if total_trash_msg != len( - self.trash_messages) else False + self.update_trash_screen_on_scroll(total_trash_msg) else: pass def update_trash_screen_on_scroll(self, total_trash_msg): """Load more data on scroll down""" - self.set_mdList(total_trash_msg, total_trash_msg + 5) + self.trashDataQuery(total_trash_msg, 5) + self.set_mdList() def delete_permanently(self, data_index, folder, instance, *args): """Deleting trash mail permanently""" @@ -1307,33 +1322,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods self.root.ids.sc17.add_widget(Allmails()) self.root.ids.scr_mngr.current = 'inbox' - msg_counter_objs = ( - self.root_window.children[2].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 toaddress = '{}' 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 toaddress = '{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]) - state.all_count = str(int(state.sent_count) + int(state.inbox_count)) - - 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 - msg_counter_objs.allmail_cnt.badge_text = state.all_count + self.set_message_count() @staticmethod def getCurrentAccount(): @@ -1525,6 +1514,48 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods state.detailPageType = '' state.in_composer = False + def get_inbox_count(self): + state.inbox_count = str( + sqlQuery( + "SELECT COUNT(*) FROM inbox WHERE toaddress = '{}' and" + " folder = 'inbox' ;".format(state.association))[0][0]) + + def get_sent_count(self): + state.sent_count = str( + sqlQuery( + "SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and" + " folder = 'sent' ;".format(state.association))[0][0]) + + def set_message_count(self): + try: + msg_counter_objs = ( + self.root_window.children[0].children[2].children[0].ids) + except Exception as e: + msg_counter_objs = ( + self.root_window.children[2].children[2].children[0].ids) + self.get_inbox_count() + self.get_sent_count() + state.trash_count = str(sqlQuery( + "SELECT (SELECT count(*) FROM sent" + " where fromaddress = '{0}' and folder = 'trash' )" + "+(SELECT count(*) FROM inbox where toaddress = '{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]) + state.all_count = str(int(state.sent_count) + int(state.inbox_count)) + + 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 + msg_counter_objs.allmail_cnt.badge_text = state.all_count + + def on_start(self): + self.set_message_count() + @staticmethod def on_stop(): """On stop methos is used for stoping the runing script""" @@ -2045,6 +2076,7 @@ class ShowQRCode(Screen): class Draft(Screen): """Draft screen is used to show the list of draft messages""" data = ListProperty() + account = StringProperty() queryreturn = ListProperty() has_refreshed = True @@ -2062,23 +2094,21 @@ class Draft(Screen): print dt def sentaccounts(self): - """Load draft accounts""" - account = state.association - self.loadDraft(account, 'All', '') + """Load draft accounts.""" + self.account = state.association + self.loadDraft() - def loadDraft(self, account, where="", what=""): - """Load draft list for Draft messages""" + def loadDraft(self, where="", what=""): + """Load draft list for Draft messages.""" xAddress = 'fromaddress' - self.queryreturn = kivy_helper_search.search_sql( - xAddress, account, "draft", where, what, False) + self.draftDataQuery(xAddress, where, what) if state.msg_counter_objs: state.msg_counter_objs.draft_cnt.badge_text = str( len(self.queryreturn)) if self.queryreturn: src_mng_obj = state.kivyapp.root.children[2].children[0].ids - src_mng_obj.draft_cnt.badge_text = str(len(self.queryreturn)) - state.draft_count = str(len(self.queryreturn)) - self.set_mdList(0, 20) + src_mng_obj.draft_cnt.badge_text = state.draft_count + self.set_mdList() self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( @@ -2091,10 +2121,16 @@ class Draft(Screen): valign='top') self.ids.ml.add_widget(content) - def set_mdList(self, first_index, last_index): - """Create mdlist""" + def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20): + """This methosd is for retrieving draft messages""" + self.queryreturn = kivy_helper_search.search_sql( + xAddress, self.account, "draft", where, what, False, start_indx, end_indx) + + def set_mdList(self): + """This method is used to create mdlist""" data = [] - for mail in self.queryreturn[first_index:last_index]: + total_draft_msg = len(self.ids.ml.children) + for mail in self.queryreturn: third_text = mail[3].replace('\n', ' ') data.append({ 'text': mail[1].strip(), @@ -2128,22 +2164,22 @@ class Draft(Screen): carousel.add_widget(meny) carousel.index = 1 self.ids.ml.add_widget(carousel) + updated_msg = len(self.ids.ml.children) + self.has_refreshed = True if total_draft_msg != updated_msg else False def check_scroll_y(self, instance, somethingelse): """Load data on scroll""" if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed: self.ids.scroll_y.scroll_y = 0.06 total_draft_msg = len(self.ids.ml.children) - if total_draft_msg != len(self.queryreturn): - self.update_draft_screen_on_scroll(total_draft_msg) - self.has_refreshed = True if total_draft_msg != len( - self.queryreturn) else False + self.update_draft_screen_on_scroll(total_draft_msg) else: pass - def update_draft_screen_on_scroll(self, total_draft_msg): + def update_draft_screen_on_scroll(self, total_draft_msg, where='', what=''): """Load more data on scroll down""" - self.set_mdList(total_draft_msg, total_draft_msg + 5) + self.draftDataQuery('fromaddress', where, what, total_draft_msg, 5) + self.set_mdList() def draft_detail(self, ackdata, *args): """Show draft Details""" @@ -2234,9 +2270,10 @@ class Allmails(Screen): data = ListProperty() has_refreshed = True all_mails = ListProperty() + account = StringProperty() def __init__(self, *args, **kwargs): - """Method Parsing the address""" + """Method Parsing the address.""" super(Allmails, self).__init__(*args, **kwargs) if state.association == '': if BMConfigParser().addresses(): @@ -2249,26 +2286,20 @@ class Allmails(Screen): print dt def mailaccounts(self): - """Load all mails for account""" - account = state.association - self.loadMessagelist(account, 'All', '') + """Load all mails for account.""" + self.account = state.association + self.loadMessagelist() - def loadMessagelist(self, account, where="", what=""): - """Load Inbox, Sent anf Draft list of messages""" - self.all_mails = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder, ackdata" - " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" - " folder = 'sent' and fromaddress = '{0}' UNION SELECT toaddress," - " fromaddress, subject, message, folder, msgid As id," - " DATE(received) As actionTime FROM inbox WHERE" - " folder = 'inbox' and toaddress = '{0}'" - " ORDER BY actionTime DESC".format(account)) + def loadMessagelist(self): + """Load Inbox, Sent anf Draft list of messages.""" + self.allMessageQuery(0, 20) if self.all_mails: + state.kivyapp.get_inbox_count() + state.kivyapp.get_sent_count() + state.all_count = str(int(state.sent_count) + int(state.inbox_count)) state.kivyapp.root.children[2].children[ - 0].ids.allmail_cnt.badge_text = str( - len(self.all_mails)) - state.all_count = str(len(self.all_mails)) - self.set_mdlist(0, 20) + 0].ids.allmail_cnt.badge_text = state.all_count + self.set_mdlist() self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( @@ -2281,9 +2312,19 @@ class Allmails(Screen): valign='top') self.ids.ml.add_widget(content) - def set_mdlist(self, start_pnt, end_pnt): - """Create mdList for allmaills""" - for item in self.all_mails[start_pnt:end_pnt]: + def allMessageQuery(self, start_indx, end_indx): + """This method is used for retrieving data from inbox or sent both tables""" + self.all_mails = sqlQuery( + "SELECT toaddress, fromaddress, subject, message, folder, ackdata" + " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" + " folder = 'sent' and fromaddress = '{0}' UNION SELECT toaddress, fromaddress, subject," + " message, folder, msgid As id, DATE(received) As actionTime" + " FROM inbox WHERE folder = 'inbox' and toaddress = '{0}' ORDER BY actionTime DESC limit {1}, {2}".format(self.account, start_indx, end_indx)) + + def set_mdlist(self): + """This method is used to create mdList for allmaills""" + data_exist = len(self.ids.ml.children) + for item in self.all_mails: meny = TwoLineAvatarIconListItem( text=item[1], secondary_text=item[2][:50] + '........' if len( @@ -2312,6 +2353,8 @@ class Allmails(Screen): carousel.add_widget(meny) carousel.index = 1 self.ids.ml.add_widget(carousel) + updated_data = len(self.ids.ml.children) + self.has_refreshed = True if data_exist != updated_data else False def check_scroll_y(self, instance, somethingelse): """Scroll fixed length""" @@ -2323,12 +2366,10 @@ class Allmails(Screen): pass def updating_allmail(self, load_more): - """Update the all mail listing value on the scroll of screen""" - if self.all_mails and load_more != len(self.all_mails): - state.all_count = str(len(self.all_mails)) - self.set_mdlist(load_more, load_more + 5) - self.has_refreshed = True if load_more != len( - self.all_mails) else False + """This method is used to update the all mail + listing value on the scroll of screen""" + self.allMessageQuery(load_more, 5) + self.set_mdlist() def mail_detail(self, unique_id, folder, *args): """Load sent and inbox mail details""" From 516f0a26adf480f9e32e160cdc40663a6a2840dd Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Thu, 5 Dec 2019 19:06:33 +0530 Subject: [PATCH 16/22] mpybit fixes --- src/bitmessagekivy/mpybit.py | 85 +++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 21 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index a2c10f0e..3f5445c2 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -90,7 +90,8 @@ class Inbox(Screen): super(Inbox, self).__init__(*args, **kwargs) Clock.schedule_once(self.init_ui, 0) - def set_defaultAddress(self): + @staticmethod + def set_defaultAddress(): """This method set default address""" if state.association == '': if BMConfigParser().addresses(): @@ -140,10 +141,18 @@ class Inbox(Screen): valign='top') self.ids.ml.add_widget(content) + # pylint: disable=too-many-arguments def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20): """This method used for retrieving inbox data""" self.queryreturn = kivy_helper_search.search_sql( - xAddress, self.account, "inbox", where, what, False, start_indx, end_indx) + xAddress, + self.account, + "inbox", + where, + what, + False, + start_indx, + end_indx) def set_mdList(self, data): """This method is used to create the mdList""" @@ -402,7 +411,8 @@ class MyAddress(Screen): # if filter(lambda x: (state.searcing_text).lower() in x, [ # BMConfigParser().get( # address, 'label').lower(), address.lower()]): - if [x for x in [BMConfigParser().get(address, 'label').lower(), address.lower()]]: + if [x for x in [BMConfigParser().get( + address, 'label').lower(), address.lower()]]: return True return False @@ -829,7 +839,8 @@ class Random(Screen): self.manager.current = 'myaddress' Clock.schedule_once(self.address_created_callback, 6) - def address_created_callback(self, dt=0): + @staticmethod + def address_created_callback(dt=0): """New address created""" state.kivyapp.root.ids.sc10.children[1].active = False state.kivyapp.root.ids.sc10.ids.ml.clear_widgets() @@ -915,10 +926,18 @@ class Sent(Screen): valign='top') self.ids.ml.add_widget(content) + # pylint: disable=too-many-arguments def sentDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20): """This method is used to retrieving data from sent table""" self.queryreturn = kivy_helper_search.search_sql( - xAddress, self.account, "sent", where, what, False, start_indx, end_indx) + xAddress, + self.account, + "sent", + where, + what, + False, + start_indx, + end_indx) def set_mdlist(self, data, set_index=0): """This method is used to create the mdList""" @@ -959,14 +978,13 @@ class Sent(Screen): def update_sent_messagelist(self): """This method is used to update screen when new mail is sent""" + self.account = state.association if len(self.ids.ml.children) < 3: - self.account = state.association self.ids.ml.clear_widgets() self.loadSent() total_sent = int(state.sent_count) + 1 self.set_sentCount(total_sent) else: - account = state.association data = [] self.sentDataQuery('fromaddress', '', '', 0, 1) total_sent = int(state.sent_count) + 1 @@ -1111,11 +1129,18 @@ class Trash(Screen): self.ids.ml.add_widget(content) def trashDataQuery(self, start_indx, end_indx): + """Trash message query""" self.trash_messages = sqlQuery( - "SELECT toaddress, fromaddress, subject, message, folder ||',' || 'sent' as folder, ackdata As id, DATE(lastactiontime)" - " As actionTime FROM sent WHERE folder = 'trash' and fromaddress = '{0}' UNION" - " SELECT toaddress, fromaddress, subject, message, folder ||',' || 'inbox' as folder, msgid As id, DATE(received) As" - " actionTime FROM inbox WHERE folder = 'trash' and toaddress = '{0}' ORDER BY actionTime DESC limit {1}, {2}".format(state.association, start_indx, end_indx)) + "SELECT toaddress, fromaddress, subject, message," + " folder ||',' || 'sent' as folder, ackdata As" + " id, DATE(lastactiontime) As actionTime FROM sent" + " WHERE folder = 'trash' and fromaddress = '{0}' UNION" + " SELECT toaddress, fromaddress, subject, message," + " folder ||',' || 'inbox' as folder, msgid As id," + " DATE(received) As actionTime FROM inbox" + " WHERE folder = 'trash' and toaddress = '{0}'" + " ORDER BY actionTime DESC limit {1}, {2}".format( + state.association, start_indx, end_indx)) def set_mdList(self): """This method is used to create the mdlist""" @@ -1148,7 +1173,7 @@ class Trash(Screen): carousel.index = 1 self.ids.ml.add_widget(carousel) self.has_refreshed = True if total_trash_msg != len( - self.ids.ml.children) else False + self.ids.ml.children) else False def check_scroll_y(self, instance, somethingelse): """Load data on scroll""" @@ -1220,6 +1245,7 @@ class Page(Screen): class Create(Screen): """Creates the screen widgets""" + def __init__(self, **kwargs): """Getting Labels and address from addressbook""" super(Create, self).__init__(**kwargs) @@ -1514,23 +1540,28 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods state.detailPageType = '' state.in_composer = False - def get_inbox_count(self): + @staticmethod + def get_inbox_count(): + """Getting inbox count""" state.inbox_count = str( sqlQuery( "SELECT COUNT(*) FROM inbox WHERE toaddress = '{}' and" " folder = 'inbox' ;".format(state.association))[0][0]) - def get_sent_count(self): + @staticmethod + def get_sent_count(): + """Getting sent count""" state.sent_count = str( sqlQuery( "SELECT COUNT(*) FROM sent WHERE fromaddress = '{}' and" " folder = 'sent' ;".format(state.association))[0][0]) def set_message_count(self): + """Setting message count""" try: msg_counter_objs = ( self.root_window.children[0].children[2].children[0].ids) - except Exception as e: + except Exception: msg_counter_objs = ( self.root_window.children[2].children[2].children[0].ids) self.get_inbox_count() @@ -2121,10 +2152,18 @@ class Draft(Screen): valign='top') self.ids.ml.add_widget(content) + # pylint: disable=too-many-arguments def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20): """This methosd is for retrieving draft messages""" self.queryreturn = kivy_helper_search.search_sql( - xAddress, self.account, "draft", where, what, False, start_indx, end_indx) + xAddress, + self.account, + "draft", + where, + what, + False, + start_indx, + end_indx) def set_mdList(self): """This method is used to create mdlist""" @@ -2296,7 +2335,8 @@ class Allmails(Screen): if self.all_mails: state.kivyapp.get_inbox_count() state.kivyapp.get_sent_count() - state.all_count = str(int(state.sent_count) + int(state.inbox_count)) + state.all_count = str( + int(state.sent_count) + int(state.inbox_count)) state.kivyapp.root.children[2].children[ 0].ids.allmail_cnt.badge_text = state.all_count self.set_mdlist() @@ -2313,13 +2353,16 @@ class Allmails(Screen): self.ids.ml.add_widget(content) def allMessageQuery(self, start_indx, end_indx): - """This method is used for retrieving data from inbox or sent both tables""" + """Retrieving data from inbox or sent both tables""" self.all_mails = sqlQuery( "SELECT toaddress, fromaddress, subject, message, folder, ackdata" " As id, DATE(lastactiontime) As actionTime FROM sent WHERE" - " folder = 'sent' and fromaddress = '{0}' UNION SELECT toaddress, fromaddress, subject," - " message, folder, msgid As id, DATE(received) As actionTime" - " FROM inbox WHERE folder = 'inbox' and toaddress = '{0}' ORDER BY actionTime DESC limit {1}, {2}".format(self.account, start_indx, end_indx)) + " folder = 'sent' and fromaddress = '{0}'" + " UNION SELECT toaddress, fromaddress, subject, message, folder," + " msgid As id, DATE(received) As actionTime FROM inbox" + " WHERE folder = 'inbox' and toaddress = '{0}'" + " ORDER BY actionTime DESC limit {1}, {2}".format( + self.account, start_indx, end_indx)) def set_mdlist(self): """This method is used to create mdList for allmaills""" From e458de733e6c2c3c6fb9345f227f9bdeab354343 Mon Sep 17 00:00:00 2001 From: navjot Date: Tue, 10 Dec 2019 17:02:18 +0530 Subject: [PATCH 17/22] worked on addressbook address validation --- src/bitmessagekivy/kivy_helper_search.py | 4 +- src/bitmessagekivy/main.kv | 41 ++++++--- src/bitmessagekivy/mpybit.py | 108 +++++++++++++++++------ 3 files changed, 110 insertions(+), 43 deletions(-) diff --git a/src/bitmessagekivy/kivy_helper_search.py b/src/bitmessagekivy/kivy_helper_search.py index 829d4f00..48e77cb2 100644 --- a/src/bitmessagekivy/kivy_helper_search.py +++ b/src/bitmessagekivy/kivy_helper_search.py @@ -62,6 +62,6 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w sqlStatementBase += " ORDER BY lastactiontime DESC limit {0}, {1}".format(start_indx, end_indx) elif folder == "inbox": sqlStatementBase += " ORDER BY received DESC limit {0}, {1}".format(start_indx, end_indx) - elif folder == "addressbook": - sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx) + # elif folder == "addressbook": + # sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx) return sqlQuery(sqlStatementBase, sqlArguments) diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 1c2e3c6a..6b6cde88 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -99,6 +99,7 @@ icon:'contact-mail' on_release: app.root.ids.scr_mngr.current = 'allmails' badge_text: "0" + on_press: app.load_screen(self) NavigationDrawerDivider: NavigationDrawerSubheader: text: "All labels" @@ -203,11 +204,18 @@ NavigationLayout: orientation: 'vertical' spacing: dp(10) SearchBar: - FloatLayout: - MDScrollViewRefreshLayout: - id: refresh_layout - refresh_callback: root.refresh_callback - root_layout: root.set_root_layout() + #FloatLayout: + # MDScrollViewRefreshLayout: + # id: refresh_layout + # refresh_callback: root.refresh_callback + # root_layout: root.set_root_layout() + # MDList: + # id: ml + BoxLayout: + orientation:'vertical' + ScrollView: + id: scroll_y + do_scroll_x: False MDList: id: ml Loader: @@ -273,13 +281,21 @@ NavigationLayout: : name: 'allmails' - FloatLayout: - MDScrollViewRefreshLayout: - id: refresh_layout - refresh_callback: root.refresh_callback - root_layout: root.set_root_layout() + #FloatLayout: + # MDScrollViewRefreshLayout: + # id: refresh_layout + # refresh_callback: root.refresh_callback + # root_layout: root.set_root_layout() + # MDList: + # id: ml + BoxLayout: + orientation:'vertical' + ScrollView: + id: scroll_y + do_scroll_x: False MDList: id: ml + Loader: ComposerButton: : @@ -366,7 +382,8 @@ NavigationLayout: size_hint_y: None font_size: '13sp' height: self.parent.height/2 - hint_text: 'type or search recipients address starting with BM-' + #hint_text: 'type or search recipients address starting with BM-' + hint_text: 'type, select or scan QR code for recipients address' RV: id: rv MDTextField: @@ -648,7 +665,7 @@ NavigationLayout: do_scroll_x: False BoxLayout: orientation: 'vertical' - padding: [dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/4*1.1), dp(10)] + padding: [dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/4*1.1 if app.window_size[0] <= 800 else app.window_size[0]/18), dp(10)] spacing: 12 size_hint_y: None height: self.minimum_height + dp(app.window_size[1]) if app.window_size[1] > app.window_size[0] else dp(app.window_size[0]) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 3f5445c2..5fc561da 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -62,6 +62,7 @@ import state from uikivysignaler import UIkivySignaler import identiconGeneration +from addresses import addBMIfNotPresent, decodeAddress, encodeVarint def toast(text): @@ -298,9 +299,9 @@ class Inbox(Screen): Clock.schedule_once(refresh_callback, 1) - def set_root_layout(self): - """Setting root layout""" - return self.parent.parent.parent + # def set_root_layout(self): + # """Setting root layout""" + # return self.parent.parent.parent class MyAddress(Screen): @@ -652,8 +653,8 @@ class DropDownWidget(BoxLayout): # self.parent.parent.screens[0].ids.ml.clear_widgets() # self.parent.parent.screens[0].loadMessagelist(state.association) self.parent.parent.screens[3].update_sent_messagelist() - self.parent.parent.screens[16].clear_widgets() - self.parent.parent.screens[16].add_widget(Allmails()) + # self.parent.parent.screens[16].clear_widgets() + # self.parent.parent.screens[16].add_widget(Allmails()) Clock.schedule_once(self.callback_for_msgsend, 3) queues.workerQueue.put(('sendmessage', toAddress)) print "sqlExecute successfully #######################" @@ -1331,6 +1332,11 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods state.association = text state.searcing_text = '' LoadingPopup().open() + self.set_message_count() + Clock.schedule_once(self.setCurrentAccountData, 0.5) + + def setCurrentAccountData(self, dt=0): + """This method set the current accout data on all the screens.""" self.root.ids.sc1.ids.ml.clear_widgets() self.root.ids.sc1.loadMessagelist(state.association) @@ -1348,7 +1354,6 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods self.root.ids.sc17.add_widget(Allmails()) self.root.ids.scr_mngr.current = 'inbox' - self.set_message_count() @staticmethod def getCurrentAccount(): @@ -1699,18 +1704,32 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods if instance.text == 'Inbox': self.root.ids.scr_mngr.current = 'inbox' self.root.ids.sc1.children[1].active = True - self.root.ids.sc1.ids.ml.clear_widgets() - Clock.schedule_once(partial(self.load_screen_callback, instance), 0.5) + elif instance.text == 'All Mails': + self.root.ids.scr_mngr.current = 'allmails' + try: + self.root.ids.sc17.children[1].active = True + except Exception as e: + self.root.ids.sc17.children[0].children[1].active = True + Clock.schedule_once(partial(self.load_screen_callback, instance), 1) def load_screen_callback(self, instance, dt=0): """This method is rotating loader for few seconds""" if instance.text == 'Inbox': + self.root.ids.sc1.ids.ml.clear_widgets() self.root.ids.sc1.loadMessagelist(state.association) self.root.ids.sc1.children[1].active = False + elif instance.text == 'All Mails': + self.root.ids.sc17.clear_widgets() + self.root.ids.sc17.add_widget(Allmails()) + try: + self.root.ids.sc17.children[1].active = False + except Exception as e: + self.root.ids.sc17.children[0].children[1].active = False class GrashofPopup(Popup): """Moule for save contacts and error messages""" + valid = False def __init__(self, **kwargs): # pylint: disable=useless-super-delegation """Grash of pop screen settings""" @@ -1733,7 +1752,7 @@ class GrashofPopup(Popup): stored_labels = [labels[0] for labels in kivy_helper_search.search_sql( folder="addressbook")] if label and address and address not in stored_address \ - and label not in stored_labels: + and label not in stored_labels and self.valid: # state.navinstance = self.parent.children[1] queues.UISignalQueue.put(('rerenderAddressBook', '')) self.dismiss() @@ -1779,12 +1798,17 @@ class GrashofPopup(Popup): text = 'Address is already in the addressbook.' elif entered_text in my_addresses: text = 'You can not save your own address.' + elif entered_text: + text = self.addressChanged(entered_text) if entered_text in my_addresses or entered_text in add_book: self.ids.address.error = True self.ids.address.helper_text = text - elif entered_text: + elif entered_text and self.valid: self.ids.address.error = False + elif entered_text: + self.ids.address.error = True + self.ids.address.helper_text = text else: self.ids.address.error = False self.ids.address.helper_text = 'This field is required' @@ -1803,6 +1827,33 @@ class GrashofPopup(Popup): self.ids.label.error = False self.ids.label.helper_text = 'This field is required' + def _onSuccess(self, addressVersion, streamNumber, ripe): + pass + + def addressChanged(self, addr): + """Address validation callback, performs validation and gives feedback""" + status, addressVersion, streamNumber, ripe = decodeAddress( + str(addr)) + self.valid = status == 'success' + if self.valid: + text = "Address is valid." + self._onSuccess(addressVersion, streamNumber, ripe) + elif status == 'missingbm': + text = "The address should start with ''BM-''" + elif status == 'checksumfailed': + text = "The address is not typed or copied correctly(the checksum failed)." + elif status == 'versiontoohigh': + text = "The version number of this address is higher than this software can support. Please upgrade Bitmessage." + elif status == 'invalidcharacters': + text = "The address contains invalid characters." + elif status == 'ripetooshort': + text = "Some data encoded in the address is too short." + elif status == 'ripetoolong': + text = "Some data encoded in the address is too long." + elif status == 'varintmalformed': + text = "Some data encoded in the address is malformed." + return text + class AvatarSampleWidget(ILeftBody, Image): """Avatar Sample Widget""" @@ -2321,16 +2372,12 @@ class Allmails(Screen): def init_ui(self, dt=0): """Clock Schdule for method all mails""" - self.mailaccounts() - print dt - - def mailaccounts(self): - """Load all mails for account.""" - self.account = state.association self.loadMessagelist() + print dt def loadMessagelist(self): """Load Inbox, Sent anf Draft list of messages.""" + self.account = state.association self.allMessageQuery(0, 20) if self.all_mails: state.kivyapp.get_inbox_count() @@ -2340,7 +2387,8 @@ class Allmails(Screen): state.kivyapp.root.children[2].children[ 0].ids.allmail_cnt.badge_text = state.all_count self.set_mdlist() - self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) + # self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y) + self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: content = MDLabel( font_style='Body1', @@ -2401,8 +2449,8 @@ class Allmails(Screen): def check_scroll_y(self, instance, somethingelse): """Scroll fixed length""" - if self.ids.refresh_layout.scroll_y <= -0.00 and self.has_refreshed: - self.ids.refresh_layout.scroll_y = .06 + if self.ids.scroll_y.scroll_y <= -0.00 and self.has_refreshed: + self.ids.scroll_y.scroll_y = .06 load_more = len(self.ids.ml.children) self.updating_allmail(load_more) else: @@ -2439,13 +2487,13 @@ class Allmails(Screen): unique_id)) self.ids.ml.remove_widget(instance.parent.parent) try: - msg_count_objs = self.parent.parent.parent.parent.children[ - 2].children[0].ids - nav_lay_obj = self.parent.parent.parent.parent.ids - except Exception: msg_count_objs = self.parent.parent.parent.parent.parent.children[ 2].children[0].ids nav_lay_obj = self.parent.parent.parent.parent.parent.ids + except Exception: + msg_count_objs = self.parent.parent.parent.parent.parent.parent.children[ + 2].children[0].ids + nav_lay_obj = self.parent.parent.parent.parent.parent.parent.ids if folder == 'inbox': msg_count_objs.inbox_cnt.badge_text = str( int(state.inbox_count) - 1) @@ -2466,8 +2514,7 @@ class Allmails(Screen): state.all_count = str(int(state.all_count) - 1) nav_lay_obj.sc5.clear_widgets() nav_lay_obj.sc5.add_widget(Trash()) - nav_lay_obj.sc17.clear_widgets() - nav_lay_obj.sc17.add_widget(Allmails()) + nav_lay_obj.sc17.remove_widget(instance.parent.parent) # pylint: disable=attribute-defined-outside-init def refresh_callback(self, *args): @@ -2496,10 +2543,13 @@ class Allmails(Screen): def avatarImageFirstLetter(letter_string): """This function is used to the first letter for the avatar image""" - if letter_string[0].upper() >= 'A' and letter_string[0].upper() <= 'Z': - img_latter = letter_string[0].upper() - elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9: - img_latter = letter_string[0] + if letter_string: + if letter_string[0].upper() >= 'A' and letter_string[0].upper() <= 'Z': + img_latter = letter_string[0].upper() + elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9: + img_latter = letter_string[0] + else: + img_latter = '!' else: img_latter = '!' return img_latter From e092ca7aa6a17ad630748f13ee87195bd75c27b8 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Tue, 10 Dec 2019 19:07:48 +0530 Subject: [PATCH 18/22] mpybit fixes --- src/bitmessagekivy/kivy_helper_search.py | 20 +++++++++++++------- src/bitmessagekivy/mpybit.py | 13 +++++-------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/bitmessagekivy/kivy_helper_search.py b/src/bitmessagekivy/kivy_helper_search.py index 48e77cb2..085e2aa2 100644 --- a/src/bitmessagekivy/kivy_helper_search.py +++ b/src/bitmessagekivy/kivy_helper_search.py @@ -4,7 +4,9 @@ Sql queries for bitmessagekivy from helper_sql import sqlQuery -def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, what=None, unreadOnly=False, start_indx=0, end_indx=20): +def search_sql( + xAddress="toaddress", account=None, folder="inbox", where=None, + what=None, unreadOnly=False, start_indx=0, end_indx=20): """Method helping for searching mails""" # pylint: disable=too-many-arguments, too-many-branches if what is not None and what != "": @@ -14,14 +16,14 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w if folder == "sent" or folder == "draft": sqlStatementBase = ( - '''SELECT toaddress, fromaddress, subject, message, status, ackdata,''' - ''' lastactiontime FROM sent ''') + '''SELECT toaddress, fromaddress, subject, message, status,''' + ''' ackdata, lastactiontime FROM sent ''') elif folder == "addressbook": sqlStatementBase = '''SELECT label, address From addressbook ''' else: sqlStatementBase = ( - '''SELECT folder, msgid, toaddress, message, fromaddress, subject,''' - ''' received, read FROM inbox ''') + '''SELECT folder, msgid, toaddress, message, fromaddress,''' + ''' subject, received, read FROM inbox ''') sqlStatementParts = [] sqlArguments = [] @@ -59,9 +61,13 @@ def search_sql(xAddress="toaddress", account=None, folder="inbox", where=None, w if sqlStatementParts: sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts) if folder == "sent" or folder == "draft": - sqlStatementBase += " ORDER BY lastactiontime DESC limit {0}, {1}".format(start_indx, end_indx) + sqlStatementBase += \ + " ORDER BY lastactiontime DESC limit {0}, {1}".format( + start_indx, end_indx) elif folder == "inbox": - sqlStatementBase += " ORDER BY received DESC limit {0}, {1}".format(start_indx, end_indx) + sqlStatementBase += \ + " ORDER BY received DESC limit {0}, {1}".format( + start_indx, end_indx) # elif folder == "addressbook": # sqlStatementBase += " limit {0}, {1}".format(start_indx, end_indx) return sqlQuery(sqlStatementBase, sqlArguments) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 5fc561da..b5a11667 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -62,7 +62,7 @@ import state from uikivysignaler import UIkivySignaler import identiconGeneration -from addresses import addBMIfNotPresent, decodeAddress, encodeVarint +from addresses import addBMIfNotPresent, decodeAddress def toast(text): @@ -590,7 +590,6 @@ class DropDownWidget(BoxLayout): sendMessageToPeople = True if sendMessageToPeople: if toAddress != '' and subject and message: - from addresses import decodeAddress status, addressVersionNumber, streamNumber, ripe = ( decodeAddress(toAddress)) if status == 'success': @@ -612,7 +611,6 @@ class DropDownWidget(BoxLayout): state.detailPageType = '' state.send_draft_mail = None else: - from addresses import addBMIfNotPresent toAddress = addBMIfNotPresent(toAddress) statusIconColor = 'red' if (addressVersionNumber > 4) or ( @@ -1708,7 +1706,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods self.root.ids.scr_mngr.current = 'allmails' try: self.root.ids.sc17.children[1].active = True - except Exception as e: + except Exception: self.root.ids.sc17.children[0].children[1].active = True Clock.schedule_once(partial(self.load_screen_callback, instance), 1) @@ -1723,7 +1721,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods self.root.ids.sc17.add_widget(Allmails()) try: self.root.ids.sc17.children[1].active = False - except Exception as e: + except Exception: self.root.ids.sc17.children[0].children[1].active = False @@ -1843,7 +1841,8 @@ class GrashofPopup(Popup): elif status == 'checksumfailed': text = "The address is not typed or copied correctly(the checksum failed)." elif status == 'versiontoohigh': - text = "The version number of this address is higher than this software can support. Please upgrade Bitmessage." + text = "The version number of this address is higher"\ + " than this software can support. Please upgrade Bitmessage." elif status == 'invalidcharacters': text = "The address contains invalid characters." elif status == 'ripetooshort': @@ -2311,9 +2310,7 @@ class Draft(Screen): encoding = 3 sendMessageToPeople = True if sendMessageToPeople: - from addresses import decodeAddress streamNumber, ripe = decodeAddress(toAddress)[2:] - from addresses import addBMIfNotPresent toAddress = addBMIfNotPresent(toAddress) stealthLevel = BMConfigParser().safeGetInt( 'bitmessagesettings', 'ackstealthlevel') From 55d1a4f4e1687d8f44852cc7665ddeeee726daa9 Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 18 Dec 2019 16:48:23 +0530 Subject: [PATCH 19/22] fixed draft or trash screen update issue --- src/bitmessagekivy/main.kv | 8 +------- src/bitmessagekivy/mpybit.py | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 6b6cde88..c4352cfe 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -552,12 +552,6 @@ NavigationLayout: color: (1,1,1,1) halign: 'center' -: - name: 'add_sucess' - Label: - text: 'Successfully created a new bit address' - color: 0,0,0,1 - : name: 'set' ScrollView: @@ -665,7 +659,7 @@ NavigationLayout: do_scroll_x: False BoxLayout: orientation: 'vertical' - padding: [dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/4*1.1 if app.window_size[0] <= 800 else app.window_size[0]/18), dp(10)] + padding: [dp(app.window_size[0]/16 if app.window_size[0] <= 720 else app.window_size[0]/6 if app.window_size[0] <= 800 else app.window_size[0]/18), dp(10)] spacing: 12 size_hint_y: None height: self.minimum_height + dp(app.window_size[1]) if app.window_size[1] > app.window_size[0] else dp(app.window_size[0]) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index b5a11667..a0a03f9d 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -409,11 +409,9 @@ class MyAddress(Screen): @staticmethod def filter_address(address): """Method will filter the my address list data""" - # if filter(lambda x: (state.searcing_text).lower() in x, [ - # BMConfigParser().get( - # address, 'label').lower(), address.lower()]): - if [x for x in [BMConfigParser().get( - address, 'label').lower(), address.lower()]]: + if filter(lambda x: (state.searcing_text).lower() in x, [ + BMConfigParser().get( + address, 'label').lower(), address.lower()]): return True return False @@ -608,8 +606,6 @@ class DropDownWidget(BoxLayout): str(state.send_draft_mail)) self.parent.parent.screens[15].clear_widgets() self.parent.parent.screens[15].add_widget(Draft()) - state.detailPageType = '' - state.send_draft_mail = None else: toAddress = addBMIfNotPresent(toAddress) statusIconColor = 'red' @@ -648,6 +644,12 @@ class DropDownWidget(BoxLayout): state.check_sent_acc = fromAddress state.msg_counter_objs = self.parent.parent.parent.parent\ .parent.parent.children[2].children[0].ids + if state.detailPageType == 'draft' \ + and state.send_draft_mail: + state.draft_count = str(int(state.draft_count) - 1) + state.msg_counter_objs.draft_cnt.badge_text = state.draft_count + state.detailPageType = '' + state.send_draft_mail = None # self.parent.parent.screens[0].ids.ml.clear_widgets() # self.parent.parent.screens[0].loadMessagelist(state.association) self.parent.parent.screens[3].update_sent_messagelist() @@ -884,16 +886,12 @@ class Sent(Screen): def init_ui(self, dt=0): """Clock Schdule for method sent accounts""" - self.sentaccounts() - print dt - - def sentaccounts(self): - """Load sent accounts.""" - self.account = state.association self.loadSent() + print dt def loadSent(self, where="", what=""): """Load Sent list for Sent messages.""" + self.account = state.association if state.searcing_text: self.ids.scroll_y.scroll_y = 1.0 where = ['subject', 'message'] @@ -1987,8 +1985,8 @@ class MailDetail(Screen): int(state.all_count) - 1) state.trash_count = str(int(state.trash_count) + 1) state.all_count = str(int(state.all_count) - 1) - self.parent.screens[4].ids.ml.clear_widgets() - self.parent.screens[4].init_ui(dt=0) + self.parent.screens[4].clear_widgets() + self.parent.screens[4].add_widget(Trash()) self.parent.screens[16].ids.ml.clear_widgets() self.parent.screens[16].init_ui(dt=0) Clock.schedule_once(self.callback_for_delete, 4) @@ -2288,7 +2286,8 @@ class Draft(Screen): data_index)) try: msg_count_objs = ( - self.parent.parent.parent.parent.children[2].children[0].ids) + self.parent.parent.parent.parent.parent.parent.children[ + 2].children[0].ids) except Exception: msg_count_objs = self.parent.parent.parent.parent.parent.children[ 2].children[0].ids From 65ef7b3a0ee5c0f6885a9e3545e606cbf1e803e3 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Wed, 18 Dec 2019 19:20:56 +0530 Subject: [PATCH 20/22] fixes after pull --- src/bitmessagekivy/mpybit.py | 5 +++-- src/class_singleCleaner.py | 2 +- src/state.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index a0a03f9d..64b47fa3 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -409,6 +409,7 @@ class MyAddress(Screen): @staticmethod def filter_address(address): """Method will filter the my address list data""" + # pylint: disable=deprecated-lambda if filter(lambda x: (state.searcing_text).lower() in x, [ BMConfigParser().get( address, 'label').lower(), address.lower()]): @@ -529,7 +530,7 @@ class AddressBook(Screen): class SelectableRecycleBoxLayout( FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout): """Adds selection and focus behaviour to the view""" - # pylint: disable = too-many-ancestors + # pylint: disable = too-many-ancestors, duplicate-bases pass @@ -2287,7 +2288,7 @@ class Draft(Screen): try: msg_count_objs = ( self.parent.parent.parent.parent.parent.parent.children[ - 2].children[0].ids) + 2].children[0].ids) except Exception: msg_count_objs = self.parent.parent.parent.parent.parent.children[ 2].children[0].ids diff --git a/src/class_singleCleaner.py b/src/class_singleCleaner.py index 2f435b99..e16ddcf4 100644 --- a/src/class_singleCleaner.py +++ b/src/class_singleCleaner.py @@ -21,12 +21,12 @@ It resends messages when there has been no response: # pylint: disable=relative-import, protected-access import gc import os +from datetime import datetime, timedelta import time import shared import knownnodes import queues -import shared import state import tr from bmconfigparser import BMConfigParser diff --git a/src/state.py b/src/state.py index 038e0e0a..8abd211d 100644 --- a/src/state.py +++ b/src/state.py @@ -124,4 +124,4 @@ availabe_credit = 0 in_sent_method = False -in_search_mode = False \ No newline at end of file +in_search_mode = False From 3b115adf9cc35a4b12539925ba0dce2d30d84b83 Mon Sep 17 00:00:00 2001 From: lakshyacis Date: Wed, 18 Dec 2019 19:51:24 +0530 Subject: [PATCH 21/22] fixes after pull --- src/bitmessagekivy/mpybit.py | 6 ++++-- src/class_singleCleaner.py | 2 +- src/state.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index a0a03f9d..94a461c4 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -409,6 +409,7 @@ class MyAddress(Screen): @staticmethod def filter_address(address): """Method will filter the my address list data""" + # pylint: disable=deprecated-lambda if filter(lambda x: (state.searcing_text).lower() in x, [ BMConfigParser().get( address, 'label').lower(), address.lower()]): @@ -529,7 +530,7 @@ class AddressBook(Screen): class SelectableRecycleBoxLayout( FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout): """Adds selection and focus behaviour to the view""" - # pylint: disable = too-many-ancestors + # pylint: disable = too-many-ancestors, duplicate-bases pass @@ -1586,6 +1587,7 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods msg_counter_objs.allmail_cnt.badge_text = state.all_count def on_start(self): + """Method activates on start""" self.set_message_count() @staticmethod @@ -2287,7 +2289,7 @@ class Draft(Screen): try: msg_count_objs = ( self.parent.parent.parent.parent.parent.parent.children[ - 2].children[0].ids) + 2].children[0].ids) except Exception: msg_count_objs = self.parent.parent.parent.parent.parent.children[ 2].children[0].ids diff --git a/src/class_singleCleaner.py b/src/class_singleCleaner.py index 2f435b99..e16ddcf4 100644 --- a/src/class_singleCleaner.py +++ b/src/class_singleCleaner.py @@ -21,12 +21,12 @@ It resends messages when there has been no response: # pylint: disable=relative-import, protected-access import gc import os +from datetime import datetime, timedelta import time import shared import knownnodes import queues -import shared import state import tr from bmconfigparser import BMConfigParser diff --git a/src/state.py b/src/state.py index 038e0e0a..8abd211d 100644 --- a/src/state.py +++ b/src/state.py @@ -124,4 +124,4 @@ availabe_credit = 0 in_sent_method = False -in_search_mode = False \ No newline at end of file +in_search_mode = False From 55a7a96e8cd8b9706bf22011a8b84274fff2312b Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 18 Dec 2019 20:02:03 +0530 Subject: [PATCH 22/22] fixed search enter button extra load issue --- src/bitmessagekivy/mpybit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index a0a03f9d..7aba57ad 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1432,8 +1432,8 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods self.root.ids.scr_mngr.transition.direction = 'right' self.root.ids.scr_mngr.transition.bind(on_complete=self.reset) return True - elif key == 13: - if state.search_screen == 'inbox' and state.searcing_text: + elif key == 13 and state.searcing_text: + if state.search_screen == 'inbox': self.root.ids.sc1.children[1].active = True Clock.schedule_once(self.search_callback, 0.5) elif state.search_screen == 'addressbook':