Implemement Ui for Inbox Load feature with create new address based on random number

This commit is contained in:
surbhi 2018-08-04 14:00:12 +05:30
parent 0bc1dfdc8b
commit b1f7489b09
No known key found for this signature in database
GPG Key ID: 88928762974D3618
36 changed files with 146 additions and 59 deletions

View File

@ -1,59 +1,41 @@
#:import la kivy.adapters.listadapter
#:import factory kivy.factory
#:import mpybit bitmessagekivy.mpybit
#:import ListItemButton kivy.uix.listview.ListItemButton
<Navigator>:
id: nav_drawer
NavigationDrawerIconButton:
Button:
Spinner:
pos_hint:{"x":0,"y":.3}
id: btn
background_color:app.theme_cls.primary_dark
text: 'BM-2cSvewtJw8o8eqcFzmLeXHza4BVsRsirKk'
on_release: dropdown.open(self)
pos_hint: {'x': 0, 'y': 0.3}
size_hint_y: None
height: '48dp'
DropDown:
id: dropdown
on_parent: self.dismiss()
on_select: btn.text = '{}'.format(args[1])
Button:
background_color:app.theme_cls.primary_dark
text: 'BM-2cSvewtJw8o8eqcFzmLeXHza4BVsRsirKk'
size_hint_y: None
height: '48dp'
on_release: dropdown.select('BM-2cSvewtJw8o8eqcFzmLeXHza4BVsRsirKk')
on_release: app.root.ids.scr_mngr.current = 'dialog'
Button:
background_color:app.theme_cls.primary_dark
text: 'BM-2cSvewtJw8o8eqcFzmLeXHza4BVsRsirKk'
size_hint_y: None
height: '48dp'
on_release: dropdown.select('BM-2cSvewtJw8o8eqcFzmLeXHza4BVsRsirKk')
on_release: app.root.ids.scr_mngr.current = 'button'
background_color: app.theme_cls.primary_dark
text: '<address>'
values: app.showmeaddresses()
NavigationDrawerIconButton:
icon: 'email'
icon: 'email-open'
text: "inbox"
on_release: app.root.ids.scr_mngr.current = 'inbox'
NavigationDrawerIconButton:
icon: 'email'
icon: 'mail-send'
text: "sent"
on_release: app.root.ids.scr_mngr.current = 'sent'
NavigationDrawerIconButton:
icon: 'email'
icon: 'dropbox'
text: "trash"
on_release: app.root.ids.scr_mngr.current = 'trash'
NavigationDrawerIconButton:
icon: 'email'
text: "dialog"
text: "drafts"
on_release: app.root.ids.scr_mngr.current = 'dialog'
NavigationDrawerIconButton:
icon: 'email'
icon: 'markunread-mailbox'
text: "test"
on_release: app.root.ids.scr_mngr.current = 'test'
NavigationDrawerIconButton:
text: "new identity"
icon:'notifications-add'
icon:'accounts-add'
on_release: app.root.ids.scr_mngr.current = 'newidentity'
BoxLayout:
@ -67,8 +49,8 @@ BoxLayout:
text:"EXIT"
color: 0,0,0,1
background_color: (0,0,0,0)
size_hint_y: 0.1
size_hint_x: 0.1
size_hint_y: 0.4
size_hint_x: 0.5
pos_hint: {'x': 0.8, 'y':0.4}
on_press: app.say_exit()
@ -89,10 +71,14 @@ BoxLayout:
id:sc6
NewIdentity:
id:sc7
Page:
id:sc8
AddressSuccessful:
id:sc9
Button:
height:100
size_hint_y: 0.1
size_hint_y: 0.2
size_hint_x: 0.1
pos_hint: {'x': 0.85, 'y': 0.5}
background_color: (0,0,0,0)
@ -102,8 +88,30 @@ BoxLayout:
y: self.parent.y
x: self.parent.x + self.parent.width - 50
size: 70, 70
<ListItemButton>:
height: dp(25)
size_hint: (1,.1)
selected_color: 0,0,0,0
deselected_color: 0,0,0,0
color: 0, 0,0, 1
<Inbox>:
name: 'inbox'
ScrollView:
GridLayout:
id: box_share
cols: 1
size_hint_y: None
spacing: 10
padding: 10
height: self.minimum_height
canvas:
Color:
rgb: 30,144,255
Rectangle:
pos: self.pos
size: self.size
<Sent>:
name: 'sent'
@ -141,7 +149,7 @@ BoxLayout:
pos: 10,10
id: spinner_id
text: '<select>'
values: root.showmeaddresses()
values: app.showmeaddresses()
BoxLayout:
size_hint_y: None
@ -208,7 +216,12 @@ BoxLayout:
pos:self.center_x-8, self.center_y-8
size:[16,16]
group: "money"
active: root.is_active
id:chk
text:"use a random number generator to make an address"
on_active:
root.checked = self.text
active:root.is_active
Label:
text: "use a random number generator to make an address"
color: 0,0,0,1
@ -221,9 +234,13 @@ BoxLayout:
pos:self.center_x-8, self.center_y-8
size:[16,16]
group: "money"
active: not root.is_active
id:chk
text:"use a pseudo number generator to make an address"
on_active:
root.checked = self.text
active:not root.is_active
Label:
text: "use a random number generator to make an address"
text: "use a pseudo number generator to make an address"
color: 0,0,0,1
Label:
color: 0,0,0,1
@ -254,3 +271,16 @@ BoxLayout:
size_hint_x: 0.3
height: '32dp'
pos_hint: {'x': .5, 'y': 0.1}
on_press: root.generateaddress()
<Page>:
name: 'page'
Label:
text: 'I am on description of my email yooooo'
color: 0,0,0,1
<AddressSuccessful>:
name: 'add_sucess'
Label:
text: 'Successfully created a new bit address'
color: 0,0,0,1

View File

@ -1,5 +1,6 @@
import os
import queues
import random
import shutdown
import time
@ -7,10 +8,14 @@ from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import BooleanProperty
from kivy.uix.button import Button
from kivy.clock import Clock
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.listview import ListItemButton
from navigationdrawer import NavigationDrawer
from kivy.properties import ObjectProperty, StringProperty
from kivy.properties import ObjectProperty, StringProperty, ListProperty, NumericProperty
from kivy.uix.screenmanager import Screen
from kivy.uix.textinput import TextInput
from kivymd.theming import ThemeManager
@ -21,6 +26,7 @@ from helper_ackPayload import genAckPayload
from addresses import decodeAddress, addBMIfNotPresent
from helper_sql import sqlExecute
statusIconColor = 'red'
avatarlist = os.listdir("images/ngletteravatar")
class NavigateApp(App, TextInput):
@ -38,23 +44,65 @@ class NavigateApp(App, TextInput):
App.get_running_app().stop()
shutdown.doCleanShutdown()
def showmeaddresses(self):
return BMConfigParser().addresses()
class Navigator(NavigationDrawer):
image_source = StringProperty('images/me.jpg')
image_source = StringProperty('images/qidenticon_two.png')
title = StringProperty('Navigation')
class Inbox(Screen):
def __init__(self, **kwargs):
super(Inbox, self).__init__(**kwargs)
val_y = .1
val_z = 0
my_box1 = BoxLayout(orientation='vertical')
for i in range(1, 5):
my_box1.add_widget(Label(text="I am in inbox", size_hint=(.3, .1), pos_hint={
'x': val_z, 'top': val_y}, color=(0, 0, 0, 1), background_color=(0, 0, 0, 0)))
val_y += .1
self.add_widget(my_box1)
def __init__(self, *args, **kwargs):
super(Inbox, self).__init__(*args, **kwargs)
Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0):
self.orientation = "vertical"
self.create_button(self.ids.box_share)
def create_button(self, box_share):
top_logo_share = 1.01
top_button_share = 1.1
top_label_share = 1.4
for i in range(50):
top_logo_share -= .4
top_button_share -= .4
top_label_share -= .4
logo_share = \
Image(source='images/ngletteravatar/{}'.format(self.list_random(avatarlist)),
pos_hint={"center_x": .05, "top": top_logo_share},
size_hint_y=None, height=25)
button_share = \
Button(pos_hint={"x": 0, "top": top_button_share},
size_hint_y=None, height=40, text='email_{}'.format(i), background_color=NavigateApp.theme_cls.primary_dark)
button_share.bind(on_press=self.change_screen)
label_share = \
Label(text=str(i), pos_hint={"x": 0, "top": top_label_share},
size_hint_y=None)
fl = FloatLayout(size_hint_y=None, height=25)
fl.add_widget(button_share)
fl.add_widget(logo_share)
fl.add_widget(label_share)
box_share.add_widget(fl)
def list_random(self, ran):
random.shuffle(ran)
return ran[0]
def change_screen(self, instance):
self.manager.current = 'page'
print('I am {}'.format(instance.text))
class Page(Screen):
pass
class AddressSuccessful(Screen):
pass
class Sent(Screen):
@ -91,19 +139,15 @@ class Test(Screen):
pass
class Create(Screen, Widget):
class Create(Screen):
def __init__(self, *args, **kwargs):
super(Create, self).__init__(*args, **kwargs)
Clock.schedule_once(self.init_ui, 0)
def init_ui(self, dt=0):
# self.ids['recipent'].bind(text=self.on_text)
pass
def showmeaddresses(self):
return BMConfigParser().addresses()
def send(self):
# toAddress = self.ids.recipent.text
fromAddress = self.ids.spinner_id.text
@ -167,7 +211,20 @@ class Create(Screen, Widget):
class NewIdentity(Screen):
is_active = BooleanProperty(False)
checked = StringProperty("")
def generateaddress(self):
if self.checked == 'use a random number generator to make an address':
queues.apiAddressGeneratorReturnQueue.queue.clear()
streamNumberForAddress = 1
label = self.ids.label.text
eighteenByteRipe = False
nonceTrialsPerByte = 1000
payloadLengthExtraBytes = 1000
queues.addressGeneratorQueue.put((
'createRandomAddress', 4, streamNumberForAddress, label, 1, "", eighteenByteRipe, nonceTrialsPerByte, payloadLengthExtraBytes)
)
self.manager.current = 'add_sucess'
if __name__ == '__main__':
NavigateApp().run()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B