General Settings - Functional
This commit is contained in:
parent
8869f77118
commit
2c011a6c34
@ -3,7 +3,7 @@
|
|||||||
A fully Independent Application for cross platform
|
A fully Independent Application for cross platform
|
||||||
|
|
||||||
## 🎯 Purpose for BillPay
|
## 🎯 Purpose for BillPay
|
||||||
It has been difficult for me to manage my bills by having multiple apps installed on my mobile device, and I am sure many other people do too. There are many services here that provide all in one bill pay but they are so locked out we have to login to pay, and to pay we have to communicate with a third party bank account to send it credit so we can process our payments. If those services go down there is no possibility that we can further process our bills through those platforms.
|
It has been difficult for me to manage my bills by having multiple apps installed on my mobile device, and I am sure many other people do too. There are many services here that provide all in one bill pay but they are so locked out we have to login to pay, and to pay we have to communicate with a third party bank account to send it credit so we can process our payments. If those services go down there is no possibility that we can further process our bills through those platforms.
|
||||||
So what could be better than having a fully independent App where YOU control YOUR bills and payments without having to rely on a thirdparty service.
|
So what could be better than having a fully independent App where YOU control YOUR bills and payments without having to rely on a thirdparty service.
|
||||||
|
|
||||||
|
|
||||||
@ -46,5 +46,5 @@ So what could be better than having a fully independent App where YOU control YO
|
|||||||
### Developed with ❤️:
|
### Developed with ❤️:
|
||||||
|
|
||||||
<img src="https://asset.brandfetch.io/idmUOaSbid/id6mBl43Pj.jpeg" alt="drawing" width="50" height="50"/>
|
<img src="https://asset.brandfetch.io/idmUOaSbid/id6mBl43Pj.jpeg" alt="drawing" width="50" height="50"/>
|
||||||
<img src="https://asset.brandfetch.io/idbpOFBgcc/idcTemqrrW.svg" alt="drawing" width="50" height="50"/>
|
<img src="https://asset.brandfetch.io/idbpOFBgcc/idcTemqrrW.svg" alt="drawing" width="50" height="50"/>
|
||||||
<img src="https://asset.brandfetch.io/idEMZUpQF7/idvArxAqXg.svg" alt="drawing" width="50" height="50"/>
|
<img src="https://asset.brandfetch.io/idEMZUpQF7/idvArxAqXg.svg" alt="drawing" width="50" height="50"/>
|
||||||
|
13
main.py
13
main.py
@ -1,13 +1,13 @@
|
|||||||
import flet as ft
|
import flet as ft
|
||||||
from utils import views_handler
|
from utils import views_handler
|
||||||
|
from modules.settings.functions import config
|
||||||
|
|
||||||
def main(page: ft.Page):
|
def main(page: ft.Page):
|
||||||
page.title = 'BillPay'
|
page.title = 'BillPay'
|
||||||
print("Initial route:", page.route)
|
print('Initial route:', page.route)
|
||||||
|
|
||||||
def route_change(e):
|
def route_change(e):
|
||||||
print("Route change:", e.route)
|
print('Route change:', e.route)
|
||||||
page.views.clear()
|
page.views.clear()
|
||||||
page.views.append(
|
page.views.append(
|
||||||
views_handler(page)[page.route],
|
views_handler(page)[page.route],
|
||||||
@ -15,11 +15,14 @@ def main(page: ft.Page):
|
|||||||
page.update()
|
page.update()
|
||||||
|
|
||||||
def view_pop(e):
|
def view_pop(e):
|
||||||
print("View pop:", e.view)
|
print('View pop:', e.view)
|
||||||
page.views.pop()
|
page.views.pop()
|
||||||
top_view = page.views[-1]
|
top_view = page.views[-1]
|
||||||
page.go(top_view.route)
|
page.go(top_view.route)
|
||||||
|
if config.get('general', 'theme') == 'dark':
|
||||||
|
page.theme_mode = ft.ThemeMode.DARK
|
||||||
|
else:
|
||||||
|
page.theme_mode = ft.ThemeMode.LIGHT
|
||||||
page.on_route_change = route_change
|
page.on_route_change = route_change
|
||||||
page.on_view_pop = view_pop
|
page.on_view_pop = view_pop
|
||||||
page.go(page.route)
|
page.go(page.route)
|
||||||
|
@ -6,11 +6,11 @@ from datetime import datetime
|
|||||||
|
|
||||||
def greet(time: datetime):
|
def greet(time: datetime):
|
||||||
if 5 <= time.hour < 12:
|
if 5 <= time.hour < 12:
|
||||||
return "Goodmorning,"
|
return 'Goodmorning,'
|
||||||
elif 12 <= time.hour < 18:
|
elif 12 <= time.hour < 18:
|
||||||
return "Goodafternoon,"
|
return 'Goodafternoon,'
|
||||||
else:
|
else:
|
||||||
return "Goodevening,"
|
return 'Goodevening,'
|
||||||
|
|
||||||
|
|
||||||
def Home(page: ft.Page):
|
def Home(page: ft.Page):
|
||||||
@ -24,7 +24,7 @@ def Home(page: ft.Page):
|
|||||||
weight=ft.FontWeight.W_200,
|
weight=ft.FontWeight.W_200,
|
||||||
),
|
),
|
||||||
ft.Text(
|
ft.Text(
|
||||||
config.get('general', 'name').split(" ")[0],
|
config.get('general', 'name').split(' ')[0],
|
||||||
size=40,
|
size=40,
|
||||||
weight=ft.FontWeight.W_200,
|
weight=ft.FontWeight.W_200,
|
||||||
),
|
),
|
||||||
@ -32,7 +32,7 @@ def Home(page: ft.Page):
|
|||||||
ft.ResponsiveRow(
|
ft.ResponsiveRow(
|
||||||
[
|
[
|
||||||
ft.Container(
|
ft.Container(
|
||||||
content=ft.Text("A"),
|
content=ft.Text('A'),
|
||||||
margin=10,
|
margin=10,
|
||||||
padding=10,
|
padding=10,
|
||||||
bgcolor=ft.colors.with_opacity(0.1, '#000000'),
|
bgcolor=ft.colors.with_opacity(0.1, '#000000'),
|
||||||
@ -40,7 +40,7 @@ def Home(page: ft.Page):
|
|||||||
),
|
),
|
||||||
ft.Divider(),
|
ft.Divider(),
|
||||||
ft.Container(
|
ft.Container(
|
||||||
content=ft.Text("B"),
|
content=ft.Text('B'),
|
||||||
margin=10,
|
margin=10,
|
||||||
padding=10,
|
padding=10,
|
||||||
bgcolor=ft.colors.with_opacity(0.1, '#000000'),
|
bgcolor=ft.colors.with_opacity(0.1, '#000000'),
|
||||||
@ -48,7 +48,7 @@ def Home(page: ft.Page):
|
|||||||
),
|
),
|
||||||
ft.Divider(),
|
ft.Divider(),
|
||||||
ft.Container(
|
ft.Container(
|
||||||
content=ft.Text("C"),
|
content=ft.Text('C'),
|
||||||
margin=10,
|
margin=10,
|
||||||
padding=10,
|
padding=10,
|
||||||
bgcolor=ft.colors.with_opacity(0.1, '#000000'),
|
bgcolor=ft.colors.with_opacity(0.1, '#000000'),
|
||||||
@ -56,7 +56,7 @@ def Home(page: ft.Page):
|
|||||||
),
|
),
|
||||||
ft.Divider(),
|
ft.Divider(),
|
||||||
ft.Container(
|
ft.Container(
|
||||||
content=ft.Text("D"),
|
content=ft.Text('D'),
|
||||||
margin=10,
|
margin=10,
|
||||||
padding=10,
|
padding=10,
|
||||||
bgcolor=ft.colors.with_opacity(0.1, '#000000'),
|
bgcolor=ft.colors.with_opacity(0.1, '#000000'),
|
||||||
@ -74,7 +74,7 @@ def Home(page: ft.Page):
|
|||||||
content=ft.Row(
|
content=ft.Row(
|
||||||
[
|
[
|
||||||
ft.Container(
|
ft.Container(
|
||||||
content=ft.Icon(ft.icons.APPS),
|
content=ft.Icon(ft.icons.APPS, color=ft.colors.WHITE),
|
||||||
margin=10,
|
margin=10,
|
||||||
padding=10,
|
padding=10,
|
||||||
alignment=ft.alignment.center,
|
alignment=ft.alignment.center,
|
||||||
@ -85,7 +85,7 @@ def Home(page: ft.Page):
|
|||||||
on_click=None,
|
on_click=None,
|
||||||
),
|
),
|
||||||
ft.Container(
|
ft.Container(
|
||||||
content=ft.Icon(ft.icons.HISTORY),
|
content=ft.Icon(ft.icons.HISTORY, color=ft.colors.WHITE),
|
||||||
margin=10,
|
margin=10,
|
||||||
padding=10,
|
padding=10,
|
||||||
alignment=ft.alignment.center,
|
alignment=ft.alignment.center,
|
||||||
@ -96,7 +96,7 @@ def Home(page: ft.Page):
|
|||||||
on_click=None,
|
on_click=None,
|
||||||
),
|
),
|
||||||
ft.Container(
|
ft.Container(
|
||||||
content=ft.Icon(ft.icons.SETTINGS),
|
content=ft.Icon(ft.icons.SETTINGS, color=ft.colors.WHITE),
|
||||||
margin=10,
|
margin=10,
|
||||||
padding=10,
|
padding=10,
|
||||||
alignment=ft.alignment.center,
|
alignment=ft.alignment.center,
|
||||||
@ -105,10 +105,10 @@ def Home(page: ft.Page):
|
|||||||
height=60,
|
height=60,
|
||||||
border_radius=10,
|
border_radius=10,
|
||||||
ink=True,
|
ink=True,
|
||||||
on_click=lambda _: page.go("/settings"),
|
on_click=lambda _: page.go('/settings'),
|
||||||
),
|
),
|
||||||
ft.Container(
|
ft.Container(
|
||||||
content=ft.Icon(ft.icons.LIST),
|
content=ft.Icon(ft.icons.LIST, color=ft.colors.WHITE),
|
||||||
margin=10,
|
margin=10,
|
||||||
padding=10,
|
padding=10,
|
||||||
alignment=ft.alignment.center,
|
alignment=ft.alignment.center,
|
||||||
@ -117,7 +117,9 @@ def Home(page: ft.Page):
|
|||||||
height=60,
|
height=60,
|
||||||
border_radius=10,
|
border_radius=10,
|
||||||
ink=True,
|
ink=True,
|
||||||
on_click=lambda e: print("Clickable with Ink clicked!"),
|
on_click=lambda e: print(
|
||||||
|
'Clickable with Ink clicked!',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
alignment=ft.MainAxisAlignment.CENTER,
|
alignment=ft.MainAxisAlignment.CENTER,
|
||||||
|
@ -4,9 +4,10 @@ import os
|
|||||||
static = """
|
static = """
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
name =
|
name =
|
||||||
phone =
|
phone =
|
||||||
email =
|
email =
|
||||||
|
theme = dark
|
||||||
|
|
||||||
[apps]
|
[apps]
|
||||||
dhiraagu = true
|
dhiraagu = true
|
||||||
@ -57,5 +58,11 @@ class Config(ConfigParser):
|
|||||||
with open('config.ini', 'a+') as file:
|
with open('config.ini', 'a+') as file:
|
||||||
file.write(content)
|
file.write(content)
|
||||||
|
|
||||||
|
def save(self, section, key, value):
|
||||||
|
config.set(section, key, value)
|
||||||
|
with open('config.ini', 'w') as configfile:
|
||||||
|
self.write(configfile)
|
||||||
|
self.read('config.ini')
|
||||||
|
|
||||||
|
|
||||||
config = Config()
|
config = Config()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import flet as ft
|
import flet as ft
|
||||||
|
from .config import config
|
||||||
|
|
||||||
|
|
||||||
class Theme:
|
class Theme:
|
||||||
@ -8,10 +9,5 @@ class Theme:
|
|||||||
def change(self, theme: ft.ThemeMode = None):
|
def change(self, theme: ft.ThemeMode = None):
|
||||||
if theme:
|
if theme:
|
||||||
self.page.theme_mode = theme
|
self.page.theme_mode = theme
|
||||||
else:
|
print(theme)
|
||||||
self.page.theme_mode = (
|
|
||||||
ft.ThemeMode.DARK
|
|
||||||
if self.page.theme_mode == ft.ThemeMode.LIGHT
|
|
||||||
else ft.ThemeMode.LIGHT
|
|
||||||
)
|
|
||||||
self.page.update()
|
self.page.update()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import flet as ft
|
import flet as ft
|
||||||
from utils import AppView, Title
|
from utils import AppView, Title
|
||||||
from .functions import Theme
|
from .functions import Theme, config
|
||||||
|
|
||||||
|
|
||||||
def Settings(page: ft.Page):
|
def Settings(page: ft.Page):
|
||||||
@ -8,6 +8,131 @@ def Settings(page: ft.Page):
|
|||||||
expand=True,
|
expand=True,
|
||||||
)
|
)
|
||||||
settingsContainer.controls.append(ft.Text('General'))
|
settingsContainer.controls.append(ft.Text('General'))
|
||||||
|
|
||||||
|
def _on_name_change(e):
|
||||||
|
newName = ft.CupertinoTextField(value=config.get('general', 'name'))
|
||||||
|
dlg = ft.CupertinoAlertDialog(
|
||||||
|
modal=True,
|
||||||
|
title=ft.Text('Enter your Full name'),
|
||||||
|
content=newName,
|
||||||
|
actions=[
|
||||||
|
ft.CupertinoButton(
|
||||||
|
'Save', on_click=lambda _: (
|
||||||
|
setattr(
|
||||||
|
dlg, 'open', False,
|
||||||
|
),
|
||||||
|
config.save(
|
||||||
|
'general', 'name',
|
||||||
|
newName.value,
|
||||||
|
),
|
||||||
|
page.update(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ft.CupertinoButton(
|
||||||
|
'Close', on_click=lambda _: (
|
||||||
|
setattr(dlg, 'open', False),
|
||||||
|
page.update()
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
page.dialog = dlg
|
||||||
|
dlg.open = True
|
||||||
|
page.update()
|
||||||
|
|
||||||
|
def _on_phone_change(e):
|
||||||
|
newPhone = ft.CupertinoTextField(value=config.get('general', 'phone'))
|
||||||
|
dlg = ft.CupertinoAlertDialog(
|
||||||
|
modal=True,
|
||||||
|
title=ft.Text('Enter your Mobile'),
|
||||||
|
content=newPhone,
|
||||||
|
actions=[
|
||||||
|
ft.CupertinoButton(
|
||||||
|
'Save', on_click=lambda _: (
|
||||||
|
setattr(
|
||||||
|
dlg, 'open', False,
|
||||||
|
),
|
||||||
|
config.save(
|
||||||
|
'general', 'phone',
|
||||||
|
newPhone.value,
|
||||||
|
),
|
||||||
|
page.update(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ft.CupertinoButton(
|
||||||
|
'Close', on_click=lambda _: (
|
||||||
|
setattr(dlg, 'open', False),
|
||||||
|
page.update()
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
page.dialog = dlg
|
||||||
|
dlg.open = True
|
||||||
|
page.update()
|
||||||
|
|
||||||
|
def _on_email_change(e):
|
||||||
|
newEmail = ft.CupertinoTextField(value=config.get('general', 'email'))
|
||||||
|
dlg = ft.CupertinoAlertDialog(
|
||||||
|
modal=True,
|
||||||
|
title=ft.Text('Enter your Email'),
|
||||||
|
content=newEmail,
|
||||||
|
actions=[
|
||||||
|
ft.CupertinoButton(
|
||||||
|
'Save', on_click=lambda _: (
|
||||||
|
setattr(
|
||||||
|
dlg, 'open', False,
|
||||||
|
),
|
||||||
|
config.save(
|
||||||
|
'general', 'email',
|
||||||
|
newEmail.value,
|
||||||
|
),
|
||||||
|
page.update(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ft.CupertinoButton(
|
||||||
|
'Close', on_click=lambda _: (
|
||||||
|
setattr(dlg, 'open', False),
|
||||||
|
page.update()
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
page.dialog = dlg
|
||||||
|
dlg.open = True
|
||||||
|
page.update()
|
||||||
|
|
||||||
|
def _on_nid_change(e):
|
||||||
|
newNID = ft.CupertinoTextField(value=config.get('general', 'nid'))
|
||||||
|
dlg = ft.CupertinoAlertDialog(
|
||||||
|
modal=True,
|
||||||
|
title=ft.Text('Enter your NID'),
|
||||||
|
content=newNID,
|
||||||
|
actions=[
|
||||||
|
ft.CupertinoButton(
|
||||||
|
'Save', on_click=lambda _: (
|
||||||
|
setattr(
|
||||||
|
dlg, 'open', False,
|
||||||
|
),
|
||||||
|
config.save(
|
||||||
|
'general', 'nid',
|
||||||
|
newNID.value,
|
||||||
|
),
|
||||||
|
page.update(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ft.CupertinoButton(
|
||||||
|
'Close', on_click=lambda _: (
|
||||||
|
setattr(dlg, 'open', False),
|
||||||
|
page.update()
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
page.dialog = dlg
|
||||||
|
dlg.open = True
|
||||||
|
page.update()
|
||||||
|
|
||||||
generalSettings = ft.Container(
|
generalSettings = ft.Container(
|
||||||
content=ft.Column(
|
content=ft.Column(
|
||||||
controls=[
|
controls=[
|
||||||
@ -26,7 +151,7 @@ def Settings(page: ft.Page):
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding=10,
|
padding=10,
|
||||||
on_click=lambda _: print('clicked username'),
|
on_click=_on_name_change,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ft.Card(
|
ft.Card(
|
||||||
@ -44,7 +169,7 @@ def Settings(page: ft.Page):
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding=10,
|
padding=10,
|
||||||
on_click=lambda _: print('clicked phone'),
|
on_click=_on_phone_change,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ft.Card(
|
ft.Card(
|
||||||
@ -62,7 +187,7 @@ def Settings(page: ft.Page):
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding=10,
|
padding=10,
|
||||||
on_click=lambda _: print('clicked email'),
|
on_click=_on_email_change,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ft.Card(
|
ft.Card(
|
||||||
@ -80,7 +205,7 @@ def Settings(page: ft.Page):
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
padding=10,
|
padding=10,
|
||||||
on_click=lambda _: print('clicked email'),
|
on_click=_on_nid_change,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -89,35 +214,35 @@ def Settings(page: ft.Page):
|
|||||||
settingsContainer.controls.append(
|
settingsContainer.controls.append(
|
||||||
generalSettings,
|
generalSettings,
|
||||||
)
|
)
|
||||||
settingsContainer.controls.append(ft.Divider())
|
# settingsContainer.controls.append(ft.Divider())
|
||||||
settingsContainer.controls.append(ft.Text('Notifications'))
|
# settingsContainer.controls.append(ft.Text('Notifications'))
|
||||||
notificationsSettings = ft.Container(
|
# notificationsSettings = ft.Container(
|
||||||
content=ft.Column(
|
# content=ft.Column(
|
||||||
controls=[
|
# controls=[
|
||||||
ft.Card(
|
# ft.Card(
|
||||||
content=ft.Container(
|
# content=ft.Container(
|
||||||
ink=True,
|
# ink=True,
|
||||||
content=ft.Column(
|
# content=ft.Column(
|
||||||
[
|
# [
|
||||||
ft.ListTile(
|
# ft.ListTile(
|
||||||
leading=ft.Icon(ft.icons.TELEGRAM),
|
# leading=ft.Icon(ft.icons.TELEGRAM),
|
||||||
title=ft.Text('Telegram'),
|
# title=ft.Text('Telegram'),
|
||||||
subtitle=ft.Text(
|
# subtitle=ft.Text(
|
||||||
'Telegram Notifications for reminders and Bill pays',
|
# 'Telegram Notifications for reminders and Bill pays',
|
||||||
),
|
# ),
|
||||||
),
|
# ),
|
||||||
],
|
# ],
|
||||||
),
|
# ),
|
||||||
padding=10,
|
# padding=10,
|
||||||
on_click=lambda _: print('clicked username'),
|
# on_click=lambda _: print('clicked username'),
|
||||||
),
|
# ),
|
||||||
),
|
# ),
|
||||||
],
|
# ],
|
||||||
),
|
# ),
|
||||||
)
|
# )
|
||||||
settingsContainer.controls.append(
|
# settingsContainer.controls.append(
|
||||||
notificationsSettings,
|
# notificationsSettings,
|
||||||
)
|
# )
|
||||||
settingsContainer.controls.append(ft.Divider())
|
settingsContainer.controls.append(ft.Divider())
|
||||||
settingsContainer.controls.append(ft.Text('Apps'))
|
settingsContainer.controls.append(ft.Text('Apps'))
|
||||||
appsSettings = ft.Container(
|
appsSettings = ft.Container(
|
||||||
@ -241,7 +366,16 @@ def Settings(page: ft.Page):
|
|||||||
settingsContainer.controls.append(ft.Text('Theme'))
|
settingsContainer.controls.append(ft.Text('Theme'))
|
||||||
|
|
||||||
def _on_theme_change(e):
|
def _on_theme_change(e):
|
||||||
Theme(page).change()
|
if page.theme_mode == ft.ThemeMode.LIGHT:
|
||||||
|
e.value = False
|
||||||
|
config.save('general', 'theme', 'light')
|
||||||
|
else:
|
||||||
|
e.value = True
|
||||||
|
config.save('general', 'theme', 'dark')
|
||||||
|
Theme(page).change(
|
||||||
|
ft.ThemeMode.DARK if page.theme_mode ==
|
||||||
|
ft.ThemeMode.LIGHT else ft.ThemeMode.LIGHT,
|
||||||
|
)
|
||||||
themeSettings = ft.Container(
|
themeSettings = ft.Container(
|
||||||
content=ft.Column(
|
content=ft.Column(
|
||||||
controls=[
|
controls=[
|
||||||
@ -249,9 +383,9 @@ def Settings(page: ft.Page):
|
|||||||
content=ft.Container(
|
content=ft.Container(
|
||||||
content=ft.Container(
|
content=ft.Container(
|
||||||
ft.Switch(
|
ft.Switch(
|
||||||
value=True,
|
|
||||||
label=' Switch to dark theme',
|
label=' Switch to dark theme',
|
||||||
on_change=_on_theme_change,
|
on_change=_on_theme_change,
|
||||||
|
value=True,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
padding=10,
|
padding=10,
|
||||||
|
@ -2,4 +2,4 @@ import os
|
|||||||
|
|
||||||
|
|
||||||
def Title(title: str):
|
def Title(title: str):
|
||||||
return str(os.path.basename(title)).split(".")[0].title()
|
return str(os.path.basename(title)).split('.')[0].title()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user