Merge pull request #26 from cis-navjot-g/newwork

wokred on implementing free credit functionality in subscription package
This commit is contained in:
lakshyacis 2019-09-16 16:20:42 +05:30 committed by GitHub
commit c0c32ab386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 13 deletions

View File

@ -146,6 +146,11 @@
icon:'wallet' icon:'wallet'
on_release: app.root.ids.scr_mngr.current = 'payment' on_release: app.root.ids.scr_mngr.current = 'payment'
on_press: app.check_search_screen(self) on_press: app.check_search_screen(self)
NavigationDrawerIconButton:
text: "Credits"
icon:'wallet'
on_release: app.root.ids.scr_mngr.current = 'credits'
on_press: app.check_search_screen(self)
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "new address" text: "new address"
icon:'account-plus' icon:'account-plus'
@ -230,6 +235,8 @@ NavigationLayout:
id:sc16 id:sc16
Allmails: Allmails:
id:sc17 id:sc17
Credits:
id:sc18
<Inbox>: <Inbox>:
@ -293,6 +300,28 @@ NavigationLayout:
<Create>: <Create>:
name: 'create' name: 'create'
<Credits>:
name: 'credits'
ScrollView:
do_scroll_x: False
MDList:
id: ml
size_hint_y: None
height: dp(200)
OneLineListItem:
text: "Available Credits"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .6, .35
height: dp(40)
MDLabel:
font_style: 'Title'
text: root.available_credits
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<DropDownWidget>: <DropDownWidget>:
ScrollView: ScrollView:
BoxLayout: BoxLayout:
@ -621,8 +650,8 @@ NavigationLayout:
do_scroll_x: False do_scroll_x: False
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
padding: dp(20) padding: [dp(app.window_size[0]/4*1.1), dp(10)]
spacing: 10 spacing: 12
size_hint_y: None 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]) height: self.minimum_height + dp(app.window_size[1]) if app.window_size[1] > app.window_size[0] else dp(app.window_size[0])
BoxLayout: BoxLayout:
@ -630,7 +659,7 @@ NavigationLayout:
padding: dp(5) padding: dp(5)
canvas.before: canvas.before:
Color: Color:
rgba: 0.957, 0.890, 0.843, 1 rgba: app.theme_cls.primary_dark
Rectangle: Rectangle:
# self here refers to the widget i.e FloatLayout # self here refers to the widget i.e FloatLayout
pos: self.pos pos: self.pos
@ -641,31 +670,42 @@ NavigationLayout:
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: 'Platinum' text: 'Platinum'
halign: 'center' halign: 'center'
color: 1,1,1,1
MDLabel: MDLabel:
font_style: 'Subhead' font_style: 'Subhead'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: 'We provide subscriptions for proof of work calculation for first month. ' text: 'We provide subscriptions for proof of work calculation for first month. '
halign: 'center' halign: 'center'
color: 1,1,1,1
MDLabel: MDLabel:
id: free_pak
font_style: 'Headline' font_style: 'Headline'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: '€ 50.0' text: '€ 50.0'
halign: 'center' halign: 'center'
color: 1,1,1,1
MDRaisedButton: MDRaisedButton:
canvas:
Color:
rgb: (0.93, 0.93, 0.93)
Rectangle:
pos: self.pos
size: self.size
size_hint: 1, None size_hint: 1, None
height: dp(40) height: dp(40)
on_press: root.get_available_credits(self)
MDLabel: MDLabel:
font_style: 'Title' font_style: 'Title'
text: 'Get Credits' text: 'Get Free Credits'
font_size: '13sp' font_size: '13sp'
color: (1,1,1,1) color: (0,0,0,1)
halign: 'center' halign: 'center'
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
padding: dp(5) padding: dp(5)
canvas.before: canvas.before:
Color: Color:
rgba: 0.957, 0.890, 0.843, 1 rgba: app.theme_cls.primary_dark
Rectangle: Rectangle:
# self here refers to the widget i.e FloatLayout # self here refers to the widget i.e FloatLayout
pos: self.pos pos: self.pos
@ -676,31 +716,40 @@ NavigationLayout:
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: 'Silver' text: 'Silver'
halign: 'center' halign: 'center'
color: 1,1,1,1
MDLabel: MDLabel:
font_style: 'Subhead' font_style: 'Subhead'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: 'We provide for proof of work calculation for six month. ' text: 'We provide for proof of work calculation for six month. '
halign: 'center' halign: 'center'
color: 1,1,1,1
MDLabel: MDLabel:
font_style: 'Headline' font_style: 'Headline'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: '€ 100.0' text: '€ 100.0'
halign: 'center' halign: 'center'
color: 1,1,1,1
MDRaisedButton: MDRaisedButton:
canvas:
Color:
rgb: (0.93, 0.93, 0.93)
Rectangle:
pos: self.pos
size: self.size
size_hint: 1, None size_hint: 1, None
height: dp(40) height: dp(40)
MDLabel: MDLabel:
font_style: 'Title' font_style: 'Title'
text: 'Get Credits' text: 'Get Monthly Credits'
font_size: '13sp' font_size: '13sp'
color: (1,1,1,1) color: (0,0,0,1)
halign: 'center' halign: 'center'
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
padding: dp(5) padding: dp(5)
canvas.before: canvas.before:
Color: Color:
rgba: 0.957, 0.890, 0.843, 1 rgba: app.theme_cls.primary_dark
Rectangle: Rectangle:
# self here refers to the widget i.e FloatLayout # self here refers to the widget i.e FloatLayout
pos: self.pos pos: self.pos
@ -711,24 +760,33 @@ NavigationLayout:
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: 'Gold' text: 'Gold'
halign: 'center' halign: 'center'
color: 1,1,1,1
MDLabel: MDLabel:
font_style: 'Subhead' font_style: 'Subhead'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: 'We provide for proof of work calculation for 1years. ' text: 'We provide for proof of work calculation for 1years. '
halign: 'center' halign: 'center'
color: 1,1,1,1
MDLabel: MDLabel:
font_style: 'Headline' font_style: 'Headline'
theme_text_color: 'Primary' theme_text_color: 'Primary'
text: '€ 500.0' text: '€ 500.0'
halign: 'center' halign: 'center'
color: 1,1,1,1
MDRaisedButton: MDRaisedButton:
canvas:
Color:
rgb: (0.93, 0.93, 0.93)
Rectangle:
pos: self.pos
size: self.size
size_hint: 1, None size_hint: 1, None
height: dp(40) height: dp(40)
MDLabel: MDLabel:
font_style: 'Title' font_style: 'Title'
text: 'Get Credits' text: 'Get Yearly Credits'
font_size: '13sp' font_size: '13sp'
color: (1,1,1,1) color: (0,0,0,1)
halign: 'center' halign: 'center'

View File

@ -612,7 +612,20 @@ class MyTextInput(TextInput):
class Payment(Screen): class Payment(Screen):
"""Payment Method.""" """Payment Method."""
pass def get_available_credits(self, instance):
state.availabe_credit = instance.parent.children[1].text
existing_credits = state.kivyapp.root.ids.sc18.ids.ml.children[0].children[0].children[0].children[0].text
if len(existing_credits.split(' ')) > 1:
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)
class Credits(Screen):
"""Credits Method"""
available_credits = StringProperty(
'{0}'.format('0'))
class Login(Screen): class Login(Screen):

View File

@ -111,3 +111,5 @@ is_allmail = False
in_composer = False in_composer = False
write_msg = {} write_msg = {}
availabe_credit = 0