banking-breakdown/banking_breakdown/ui/__init__.py

48 lines
1.5 KiB
Python

import sys
import typing
import pandas as pd
from PyQt6.QtWidgets import QApplication
from banking_breakdown.ui.generated_wrapper import GeneratedWindowWrapper
def show_main_window(categories: typing.Sequence[str] = None,
df: pd.DataFrame = None):
app = QApplication(sys.argv)
window = GeneratedWindowWrapper()
if categories is not None:
window.add_categories(categories)
if df is not None:
window.set_statement_data(df)
window.add_warning_text("The column 't' does not exist. Please rename the"
" column containing the dates of the transactions"
" to 't'.")
window.add_warning_text("The column 'balance' does not exist. Please"
" rename the column containing the balance after"
" each transaction to 'balance'")
window.add_warning_text("The column 'value' does not exist. Please rename"
" the column containing the values of the"
" transactions to 'value'.")
window.show()
app.exec()
def main():
from banking_breakdown.statement_parser import get_stripped_statement
categories = ["Food", "Rent & Utilities", "Hobbies", "Education",
"Transportation", "Social Life", "Other"]
df = get_stripped_statement("../../res/banking_statement_2023.csv")
show_main_window(categories, df)
if __name__ == "__main__":
main()