commit f5694011b83df15e57d6b970a206452347fc300a Author: CustomIcon Date: Fri Apr 19 16:59:43 2024 +0000 Initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5155582 --- /dev/null +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml new file mode 100644 index 0000000..37295ea --- /dev/null +++ b/.onedev-buildspec.yml @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ac302f --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# BillPay + +To run the app: + +``` +flet run [app_directory] +``` \ No newline at end of file diff --git a/assets/favicon.png b/assets/favicon.png new file mode 100644 index 0000000..f84f527 Binary files /dev/null and b/assets/favicon.png differ diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000..f84f527 Binary files /dev/null and b/assets/icon.png differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..feddd47 --- /dev/null +++ b/main.py @@ -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") \ No newline at end of file diff --git a/modules/__init__.py b/modules/__init__.py new file mode 100644 index 0000000..2101c42 --- /dev/null +++ b/modules/__init__.py @@ -0,0 +1,5 @@ +from .home import Home +from .settings import Settings + + +__all__ = ["Home", "Settings"] \ No newline at end of file diff --git a/modules/home.py b/modules/home.py new file mode 100644 index 0000000..99fbc92 --- /dev/null +++ b/modules/home.py @@ -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") + ) + ], + ), + ), + ], + ) diff --git a/modules/settings/__init__.py b/modules/settings/__init__.py new file mode 100644 index 0000000..e651d71 --- /dev/null +++ b/modules/settings/__init__.py @@ -0,0 +1,4 @@ +from .settings import Settings +from .config import config + +__all__ = ["Settings", "config"] \ No newline at end of file diff --git a/modules/settings/config.py b/modules/settings/config.py new file mode 100644 index 0000000..a03f427 --- /dev/null +++ b/modules/settings/config.py @@ -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() \ No newline at end of file diff --git a/modules/settings/settings.py b/modules/settings/settings.py new file mode 100644 index 0000000..35871c2 --- /dev/null +++ b/modules/settings/settings.py @@ -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!"), + ], + ) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d54c7ec --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +flet==0.22.* \ No newline at end of file diff --git a/utils/__init__.py b/utils/__init__.py new file mode 100644 index 0000000..7e21ba1 --- /dev/null +++ b/utils/__init__.py @@ -0,0 +1,9 @@ +from .view import AppView +from .title import Title +from .views import views_handler + +__all__ = [ + "AppView", + "Title", + "views_handler" +] \ No newline at end of file diff --git a/utils/title.py b/utils/title.py new file mode 100644 index 0000000..845f035 --- /dev/null +++ b/utils/title.py @@ -0,0 +1,4 @@ +import os + +def Title(title: str): + return str(os.path.basename(title)).replace('.py', '').title() \ No newline at end of file diff --git a/utils/view.py b/utils/view.py new file mode 100644 index 0000000..1b98bd0 --- /dev/null +++ b/utils/view.py @@ -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 \ No newline at end of file diff --git a/utils/views.py b/utils/views.py new file mode 100644 index 0000000..2ee72b2 --- /dev/null +++ b/utils/views.py @@ -0,0 +1,7 @@ +from modules import Home, Settings + +def views_handler(page): + return { + '/': Home(page), + '/settings': Settings(page) + } \ No newline at end of file