Skip to content

Commit faced23

Browse files
authored
Merge pull request Bitmessage#49 from jaicis/kivyfixes
worked on payment screen UI or qr code scanner feature
2 parents 0b7070e + 05d061f commit faced23

File tree

8 files changed

+141
-33
lines changed

8 files changed

+141
-33
lines changed

src/bitmessagekivy/kv/composer.kv

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
hint_text: 'type or select sender address'
1414
size_hint_y: None
1515
height: 100
16-
font_size: '13sp'
16+
font_size: '15sp'
1717
multiline: False
1818
required: True
1919
helper_text_mode: "on_error"
@@ -26,34 +26,41 @@
2626
background_color: app.theme_cls.primary_dark
2727
values: app.variable_1
2828
on_text: root.auto_fill_fromaddr() if self.text != 'Select' else ''
29-
option_cls: Factory.get("MySpinnerOption")
29+
option_cls: Factory.get("ComposerSpinnerOption")
3030
#background_color: color_button if self.state == 'normal' else color_button_pressed
3131
#background_down: 'atlas://data/images/defaulttheme/spinner'
3232
background_normal: ''
3333
background_color: app.theme_cls.primary_color
3434
color: color_font
35-
font_size: '12.5sp'
35+
font_size: '13.5sp'
3636
ArrowImg:
3737

3838
BoxLayout:
39-
orientation: 'vertical'
40-
txt_input: txt_input
41-
rv: rv
42-
size : (890, 60)
43-
MyTextInput:
44-
id: txt_input
45-
size_hint_y: None
46-
font_size: '13sp'
47-
height: self.parent.height/2
48-
hint_text: 'type, select or scan QR code for recipients address'
49-
RV:
50-
id: rv
39+
orientation: 'horizontal'
40+
BoxLayout:
41+
orientation: 'vertical'
42+
txt_input: txt_input
43+
rv: rv
44+
size : (890, 60)
45+
MyTextInput:
46+
id: txt_input
47+
size_hint_y: None
48+
font_size: '15sp'
49+
height: self.parent.height/2
50+
# hint_text: 'type, select or scan QR code for recipients address'
51+
RV:
52+
id: rv
53+
MDIconButton:
54+
icon: 'qrcode-scan'
55+
pos_hint: {'center_x': 0, 'center_y': .8}
56+
on_press: root.qrScanner()
57+
5158
MyMDTextField:
5259
id: subject
5360
hint_text: 'subject'
5461
required: True
5562
height: 100
56-
font_size: '13sp'
63+
font_size: '15sp'
5764
size_hint_y: None
5865
multiline: False
5966
helper_text_mode: "on_error"
@@ -63,7 +70,7 @@
6370
multiline: True
6471
hint_text: 'body'
6572
size_hint_y: None
66-
font_size: '13sp'
73+
font_size: '15sp'
6774
required: True
6875
helper_text_mode: "on_error"
6976
BoxLayout:
@@ -106,4 +113,13 @@
106113
<MyMDTextField@MDTextField>:
107114
canvas.before:
108115
Color:
109-
rgba: (0,0,0,1)
116+
rgba: (0,0,0,1)
117+
118+
119+
<ComposerSpinnerOption@SpinnerOption>:
120+
font_size: '13.5sp'
121+
#background_color: color_button if self.state == 'down' else color_button_pressed
122+
#background_down: 'atlas://data/images/defaulttheme/button'
123+
background_normal: 'atlas://data/images/defaulttheme/textinput_active'
124+
background_color: app.theme_cls.primary_color
125+
color: color_font

src/bitmessagekivy/kv/payment.kv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
halign: 'center'
7979
color: 1,1,1,1
8080
MDLabel:
81+
id: py2
8182
font_style: 'H5'
8283
theme_text_color: 'Primary'
8384
text: '€ 100.0'
@@ -92,6 +93,8 @@
9293
size: self.size
9394
size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1
9495
height: dp(40)
96+
on_press: app.root.ids.scr_mngr.current = 'pay-options'
97+
on_press: root.move_to_pay_option(py2.text)
9598
MDLabel:
9699
font_style: 'H6'
97100
text: 'Get Monthly Credits'
@@ -122,6 +125,7 @@
122125
halign: 'center'
123126
color: 1,1,1,1
124127
MDLabel:
128+
id: py3
125129
font_style: 'H5'
126130
theme_text_color: 'Primary'
127131
text: '€ 500.0'
@@ -136,6 +140,8 @@
136140
size: self.size
137141
size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1
138142
height: dp(40)
143+
on_press: app.root.ids.scr_mngr.current = 'pay-options'
144+
on_press: root.move_to_pay_option(py3.text)
139145
MDLabel:
140146
font_style: 'H6'
141147
text: 'Get Yearly Credits'
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<PaymentMethods>:
2+
name: 'pay-options'
3+
ScrollView:
4+
do_scroll_x: False
5+
BoxLayout:
6+
# canvas.before:
7+
# Color:
8+
# rgba: .5,.5,.5,.5
9+
# Rectangle:
10+
# pos: self.pos
11+
# size: self.size
12+
orientation: 'vertical'
13+
padding: [self.width/4, 20, self.width/4, 20]
14+
size_hint_y: None
15+
spacing: 20
16+
height: self.minimum_height
17+
# GridLayout:
18+
# cols: 1
19+
# rows: 3
20+
# size_hint_y: None
21+
# # height: self.minimum_height
22+
# # padding: dp(10), dp(10)
23+
# spacing: dp(10)
24+
SmartTileWithLabel:
25+
# size_hint_y: None
26+
size_hint: (None, None)
27+
# pos_hint: {'x': .5, 'y': .5}
28+
height: 180
29+
width: 400
30+
id: tile_2
31+
mipmap: True
32+
source: './images/paymode/download.png'
33+
# text: "[size=12]Paypal[/size]"
34+
on_press: root.redirect_on_web(self)
35+
font_style: 'Subtitle1'
36+
SmartTileWithLabel:
37+
# size_hint_y: None
38+
size_hint: (None, None)
39+
height: 180
40+
width: 400
41+
id: tile_2
42+
mipmap: True
43+
# text: "[size=12]Crypto wallet[/size]"
44+
font_style: 'Subtitle1'
45+
source: './images/paymode/bitcoin-logo.jpg'
46+
on_press: root.redirect_on_web(self)
47+
SmartTileWithLabel:
48+
# size_hint_y: None
49+
size_hint: (None, None)
50+
height: 180
51+
width: 400
52+
id: tile_2
53+
mipmap: True
54+
# text: "[size=12]Googgle in app[/size]"
55+
font_style: 'Subtitle1'
56+
source: './images/paymode/111.webp'
57+
on_press: root.redirect_on_web(self)

src/bitmessagekivy/main.kv

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
#background_color: color_button if self.state == 'down' else color_button_pressed
2828
#background_down: 'atlas://data/images/defaulttheme/button'
2929
background_normal: 'atlas://data/images/defaulttheme/textinput_active'
30-
background_color: app.theme_cls.primary_color
30+
background_color: app.theme_cls.primary_color
31+
# text_autoupdate: True
3132
color: color_font
3233

3334
<NavigationItem>
@@ -101,7 +102,7 @@
101102
id: btn
102103
pos_hint:{"x":0,"y":0}
103104
option_cls: Factory.get("MySpinnerOption")
104-
font_size: '10.9sp'
105+
font_size: '12.5sp'
105106
text: app.getDefaultAccData()
106107
#background_color: color_button if self.state == 'normal' else color_button_pressed
107108
#background_down: 'atlas://data/images/defaulttheme/spinner'
@@ -111,11 +112,11 @@
111112
#background_color: (0.62,0.67,0.72,1)
112113
values: app.variable_1
113114
on_text:app.getCurrentAccountData(self.text)
114-
Image:
115-
source: app.get_default_image()
116-
x: self.width/6
117-
y: self.parent.y + self.parent.height/4
118-
size: self.parent.height/2, self.parent.height/2
115+
# Image:
116+
# source: app.get_default_image()
117+
# x: self.width/6
118+
# y: self.parent.y + self.parent.height/4
119+
# size: self.parent.height/2, self.parent.height/2
119120
ArrowImg:
120121
NavigationItem:
121122
id: inbox_cnt
@@ -258,6 +259,8 @@ NavigationLayout:
258259
id:sc19
259260
Archieve:
260261
id:sc20
262+
PaymentMethods:
263+
id:sc21
261264

262265
MDNavigationDrawer:
263266
id: nav_drawer

src/bitmessagekivy/mpybit.py

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
'settings', 'popup', 'allmails', 'draft',
7474
'maildetail', 'common_widgets', 'addressbook',
7575
'myaddress', 'composer', 'payment', 'sent',
76-
'network', 'login', 'credits', 'trash', 'inbox'
76+
'network', 'login', 'credits', 'trash', 'inbox',
77+
'payment_method'
7778
]
7879

7980

@@ -818,6 +819,10 @@ def auto_fill_fromaddr(self):
818819
self.ids.ti.text = self.ids.btn.text
819820
self.ids.ti.focus = True
820821

822+
def qrScanner(self):
823+
"""This method is used for scanning Qr code"""
824+
pass
825+
821826

822827
class MyTextInput(TextInput):
823828
"""Takes the text input in the field"""
@@ -835,14 +840,14 @@ def __init__(self, **kwargs):
835840

836841
def on_text(self, instance, value):
837842
"""Find all the occurrence of the word"""
838-
self.parent.parent.parent.parent.ids.rv.data = []
843+
self.parent.parent.parent.parent.parent.ids.rv.data = []
839844
matches = [self.word_list[i] for i in range(
840845
len(self.word_list)) if self.word_list[
841846
i][:self.starting_no] == value[:self.starting_no]]
842847
display_data = []
843848
for i in matches:
844849
display_data.append({'text': i})
845-
self.parent.parent.parent.parent.ids.rv.data = display_data
850+
self.parent.parent.parent.parent.parent.ids.rv.data = display_data
846851
if len(matches) <= 10:
847852
self.parent.height = (250 + (len(matches) * 20))
848853
else:
@@ -874,6 +879,9 @@ def get_available_credits(self, instance):
874879
state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format(
875880
state.availabe_credit)
876881

882+
def move_to_pay_option(self, amount):
883+
state.kivyapp.set_toolbar_for_QrCode()
884+
877885

878886
class Credits(Screen):
879887
"""Credits Method"""
@@ -1579,6 +1587,9 @@ def on_key(self, window, key, *args):
15791587
self.root.ids.scr_mngr.current = 'myaddress'
15801588
elif self.root.ids.scr_mngr.current == "random":
15811589
self.root.ids.scr_mngr.current = 'login'
1590+
elif self.root.ids.scr_mngr.current == 'pay-options':
1591+
self.set_common_header()
1592+
self.root.ids.scr_mngr.current = 'payment'
15821593
else:
15831594
if state.kivyapp.variable_1:
15841595
self.root.ids.scr_mngr.current = 'inbox'
@@ -1704,7 +1715,8 @@ def back_press(self):
17041715
if state.in_composer else 'allmails'\
17051716
if state.is_allmail else state.detailPageType\
17061717
if state.detailPageType else 'myaddress'\
1707-
if self.root.ids.scr_mngr.current == 'showqrcode' else 'inbox'
1718+
if self.root.ids.scr_mngr.current == 'showqrcode' else 'payment'\
1719+
if self.root.ids.scr_mngr.current == 'pay-options' else 'inbox'
17081720
self.root.ids.scr_mngr.transition.direction = 'right'
17091721
self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
17101722
if state.is_allmail or state.detailPageType == 'draft':
@@ -1842,7 +1854,7 @@ def refreshScreen(self):
18421854
def set_identicon(self, text):
18431855
"""Show identicon in address spinner"""
18441856
img = identiconGeneration.generate(text)
1845-
self.root.children[0].children[0].ids.btn.children[1].texture = (img.texture)
1857+
# self.root.children[0].children[0].ids.btn.children[1].texture = (img.texture)
18461858
# below line is for displaing logo
18471859
self.root.ids.content_drawer.ids.top_box.children[0].texture = (img.texture)
18481860

@@ -1941,10 +1953,11 @@ def exit_manager(self, *args):
19411953
def load_selected_Image(self, curerentAddr):
19421954
"""This method load the selected image on screen"""
19431955
top_box_obj = self.root.ids.content_drawer.ids.top_box.children[0]
1944-
spinner_img_obj = self.root.ids.content_drawer.ids.btn.children[1]
1945-
spinner_img_obj.source = top_box_obj.source ='./images/default_identicon/{0}.png'.format(curerentAddr)
1956+
# spinner_img_obj = self.root.ids.content_drawer.ids.btn.children[1]
1957+
# spinner_img_obj.source = top_box_obj.source ='./images/default_identicon/{0}.png'.format(curerentAddr)
1958+
top_box_obj.source ='./images/default_identicon/{0}.png'.format(curerentAddr)
19461959
top_box_obj.reload()
1947-
spinner_img_obj.reload()
1960+
# spinner_img_obj.reload()
19481961

19491962
def copy_composer_text(self, text):
19501963
"""Copy the data from mail detail page"""
@@ -2096,6 +2109,12 @@ class ToggleBtn(IRightBodyTouch, MDSwitch):
20962109
pass
20972110

20982111

2112+
class CheckboxLeftSampleWidget(ILeftBodyTouch, MDCheckbox):
2113+
"""Left icon sample widget"""
2114+
2115+
pass
2116+
2117+
20992118
class MailDetail(Screen):
21002119
"""MailDetail Screen uses to show the detail of mails"""
21012120

@@ -2945,5 +2964,12 @@ class ToAddrBoxlayout(BoxLayout):
29452964
to_addr = StringProperty()
29462965

29472966
def set_toAddress(self, to_addr):
2967+
"""This method is use to set to address"""
29482968
self.to_addr = to_addr
2969+
2970+
2971+
class PaymentMethods(Screen):
2972+
"""PaymentMethods Screen show widgets of page"""
2973+
2974+
def redirect_on_web(self, instance):
29492975
pass

src/images/paymode/111.webp

11.2 KB
Binary file not shown.

src/images/paymode/bitcoin-logo.jpg

8.26 KB
Loading

src/images/paymode/download.png

5.54 KB
Loading

0 commit comments

Comments
 (0)