Initial
This commit is contained in:
commit
f5694011b8
161
.gitignore
vendored
Normal file
161
.gitignore
vendored
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
.pybuilder/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# pdm
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
#pdm.lock
|
||||||
|
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||||
|
# in version control.
|
||||||
|
# https://pdm.fming.dev/#use-with-ide
|
||||||
|
.pdm.toml
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
cython_debug/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
|
#.idea/
|
||||||
|
config.ini
|
43
.onedev-buildspec.yml
Normal file
43
.onedev-buildspec.yml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
version: 31
|
||||||
|
jobs:
|
||||||
|
- name: APK Build
|
||||||
|
jobExecutor: windows-executor
|
||||||
|
steps:
|
||||||
|
- !CheckoutStep
|
||||||
|
name: Checkout Code
|
||||||
|
cloneCredential: !DefaultCredential {}
|
||||||
|
withLfs: false
|
||||||
|
withSubmodules: true
|
||||||
|
cloneDepth: 1
|
||||||
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
- !CommandStep
|
||||||
|
name: Build
|
||||||
|
runInContainer: false
|
||||||
|
interpreter: !PowerShellInterpreter
|
||||||
|
commands: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
python -m venv venv
|
||||||
|
.\venv\Scripts\activate.ps1
|
||||||
|
pip install -r requirements.txt
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
flet build apk --include-packages flet_lottie --product WAMCO --product WAMCO --org com.wamco.app --verbose
|
||||||
|
useTTY: false
|
||||||
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
- !PublishArtifactStep
|
||||||
|
name: Artifacts
|
||||||
|
artifacts: build/apk/*
|
||||||
|
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||||
|
paramSpecs:
|
||||||
|
- !CommitParam
|
||||||
|
name: Commit Check
|
||||||
|
allowEmpty: false
|
||||||
|
triggers:
|
||||||
|
- !BranchUpdateTrigger
|
||||||
|
paramMatrix:
|
||||||
|
- name: Commit Check
|
||||||
|
valuesProvider: !IgnoreValues {}
|
||||||
|
secret: false
|
||||||
|
retryCondition: never
|
||||||
|
maxRetries: 3
|
||||||
|
retryDelay: 30
|
||||||
|
timeout: 3600
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# BillPay
|
||||||
|
|
||||||
|
To run the app:
|
||||||
|
|
||||||
|
```
|
||||||
|
flet run [app_directory]
|
||||||
|
```
|
BIN
assets/favicon.png
Normal file
BIN
assets/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
26
main.py
Normal file
26
main.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import flet as ft
|
||||||
|
from utils import views_handler
|
||||||
|
|
||||||
|
|
||||||
|
def main(page: ft.Page):
|
||||||
|
page.title = "BillPay"
|
||||||
|
# print("Initial route:", page.route)
|
||||||
|
def route_change(e):
|
||||||
|
# print("Route change:", e.route)
|
||||||
|
page.views.clear()
|
||||||
|
page.views.append(
|
||||||
|
views_handler(page)[page.route]
|
||||||
|
)
|
||||||
|
page.update()
|
||||||
|
def view_pop(e):
|
||||||
|
# print("View pop:", e.view)
|
||||||
|
page.views.pop()
|
||||||
|
top_view = page.views[-1]
|
||||||
|
page.go(top_view.route)
|
||||||
|
|
||||||
|
page.on_route_change = route_change
|
||||||
|
page.on_view_pop = view_pop
|
||||||
|
page.go(page.route)
|
||||||
|
|
||||||
|
|
||||||
|
ft.app(target=main, assets_dir="assets")
|
5
modules/__init__.py
Normal file
5
modules/__init__.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from .home import Home
|
||||||
|
from .settings import Settings
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["Home", "Settings"]
|
33
modules/home.py
Normal file
33
modules/home.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import flet as ft
|
||||||
|
from utils import AppView, Title
|
||||||
|
from modules.settings import config
|
||||||
|
|
||||||
|
def Home(page: ft.Page):
|
||||||
|
return AppView(
|
||||||
|
"/",
|
||||||
|
[
|
||||||
|
ft.AppBar(
|
||||||
|
title=ft.Text(Title(__file__)),
|
||||||
|
actions=[
|
||||||
|
ft.IconButton(
|
||||||
|
icon=ft.icons.SETTINGS,
|
||||||
|
on_click=lambda _: page.go("/settings"),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
|
ft.Container(
|
||||||
|
height=100,
|
||||||
|
padding=10,
|
||||||
|
content=ft.Column(
|
||||||
|
controls=[
|
||||||
|
ft.Text(
|
||||||
|
"Goodmorning,"
|
||||||
|
),
|
||||||
|
ft.Text(
|
||||||
|
config.get("general", "name")
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
4
modules/settings/__init__.py
Normal file
4
modules/settings/__init__.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
from .settings import Settings
|
||||||
|
from .config import config
|
||||||
|
|
||||||
|
__all__ = ["Settings", "config"]
|
53
modules/settings/config.py
Normal file
53
modules/settings/config.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
from configparser import ConfigParser
|
||||||
|
import os
|
||||||
|
|
||||||
|
static = """
|
||||||
|
[general]
|
||||||
|
name =
|
||||||
|
phone =
|
||||||
|
email =
|
||||||
|
|
||||||
|
[apps]
|
||||||
|
dhiraagu = true
|
||||||
|
ooredoo = true
|
||||||
|
hdc = true
|
||||||
|
mwsc = true
|
||||||
|
stelco = true
|
||||||
|
medianet = true
|
||||||
|
|
||||||
|
[dhiraagu]
|
||||||
|
phone =
|
||||||
|
otp =
|
||||||
|
cookie =
|
||||||
|
|
||||||
|
[ooredoo]
|
||||||
|
phone =
|
||||||
|
otp =
|
||||||
|
cookie =
|
||||||
|
|
||||||
|
[hdc]
|
||||||
|
property =
|
||||||
|
nid =
|
||||||
|
|
||||||
|
[mwsc]
|
||||||
|
|
||||||
|
|
||||||
|
[stelco]
|
||||||
|
|
||||||
|
|
||||||
|
[medianet]
|
||||||
|
"""
|
||||||
|
|
||||||
|
class Config(ConfigParser):
|
||||||
|
def __init__(self) -> None:
|
||||||
|
super().__init__()
|
||||||
|
if not os.path.exists("config.ini"):
|
||||||
|
self.initialize(content=static)
|
||||||
|
self.read("config.ini")
|
||||||
|
|
||||||
|
def initialize(self, content):
|
||||||
|
with open("config.ini", 'a+') as file:
|
||||||
|
file.write(content)
|
||||||
|
|
||||||
|
|
||||||
|
config = Config()
|
19
modules/settings/settings.py
Normal file
19
modules/settings/settings.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import flet as ft
|
||||||
|
from utils import AppView, Title
|
||||||
|
|
||||||
|
|
||||||
|
def Settings(page: ft.Page):
|
||||||
|
return AppView(
|
||||||
|
"/settings",
|
||||||
|
[
|
||||||
|
ft.AppBar(
|
||||||
|
leading=ft.IconButton(
|
||||||
|
ft.icons.ARROW_BACK_IOS_NEW_ROUNDED,
|
||||||
|
on_click=lambda _: page.go("/")
|
||||||
|
),
|
||||||
|
title=ft.Text(Title(str(__file__))),
|
||||||
|
bgcolor=ft.colors.TRANSPARENT
|
||||||
|
),
|
||||||
|
ft.Text("Settings!"),
|
||||||
|
],
|
||||||
|
)
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
flet==0.22.*
|
9
utils/__init__.py
Normal file
9
utils/__init__.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
from .view import AppView
|
||||||
|
from .title import Title
|
||||||
|
from .views import views_handler
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AppView",
|
||||||
|
"Title",
|
||||||
|
"views_handler"
|
||||||
|
]
|
4
utils/title.py
Normal file
4
utils/title.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
def Title(title: str):
|
||||||
|
return str(os.path.basename(title)).replace('.py', '').title()
|
7
utils/view.py
Normal file
7
utils/view.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import flet as ft
|
||||||
|
|
||||||
|
class AppView(ft.View):
|
||||||
|
def __init__(self, route, controls):
|
||||||
|
super().__init__()
|
||||||
|
self.controls = controls
|
||||||
|
self.route = route
|
7
utils/views.py
Normal file
7
utils/views.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from modules import Home, Settings
|
||||||
|
|
||||||
|
def views_handler(page):
|
||||||
|
return {
|
||||||
|
'/': Home(page),
|
||||||
|
'/settings': Settings(page)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user