summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.py22
-rw-r--r--poetry.lock15
-rw-r--r--pyproject.toml1
-rw-r--r--requirements.txt1
4 files changed, 38 insertions, 1 deletions
diff --git a/main.py b/main.py
index 96f86c0..a9343c5 100644
--- a/main.py
+++ b/main.py
@@ -18,8 +18,16 @@ from docx import Document
from docx.shared import Inches
from docx.enum.text import WD_ALIGN_PARAGRAPH
+from platformdirs import user_data_dir
+from pathlib import Path
+
canadian_companies = []
+# Config
+appname = "PyramidScheme"
+appauthor = "Navan Chauhan"
+Path(user_data_dir(appname, appauthor)).mkdir( parents=True, exist_ok=True )
+
def get_companies_for_word_doc():
None
@@ -109,11 +117,25 @@ class CompanySelector:
self.select_file_button = ttk.Button(self.master, text="Select Excel File", command=self.load_file)
self.select_file_button.pack(pady=250)
+ try:
+ with open(path.join(user_data_dir(appname, appauthor), "default.txt")) as f:
+ try:
+ self.df = pd.read_excel(f.read())
+ self.df = self.df[self.df['Company Name'].notna()]
+ self.df = self.df[self.df['Symbol'].notna()]
+ self.show_companies()
+ except Exception as e:
+ print(f'Oh No {e}')
+ except FileNotFoundError:
+ None
+
def load_file(self):
file_path = askopenfilename(filetypes=[("Excel files", "*.xlsx *.xls")])
if not file_path:
return
+ with open(path.join(user_data_dir(appname, appauthor), "default.txt"), "w") as f:
+ f.write(file_path)
self.df = pd.read_excel(file_path)
self.df = self.df[self.df['Company Name'].notna()]
self.df = self.df[self.df['Symbol'].notna()]
diff --git a/poetry.lock b/poetry.lock
index ffa4e8f..e4c2d0e 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -239,6 +239,18 @@ docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-inline
tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"]
[[package]]
+name = "platformdirs"
+version = "3.5.1"
+description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
+category = "main"
+optional = false
+python-versions = ">=3.7"
+
+[package.extras]
+docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)", "sphinx (>=6.2.1)"]
+test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest (>=7.3.1)"]
+
+[[package]]
name = "pyinstaller"
version = "5.11.0"
description = "PyInstaller bundles a Python application and all its dependencies into a single package."
@@ -479,7 +491,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "flake8 (<5)", "pytest-co
[metadata]
lock-version = "1.1"
python-versions = ">=3.9,<3.12"
-content-hash = "242394fa63b58fdef34d257fdbf2ca18320dd2168a2c841af4e7fd9dc014afce"
+content-hash = "0bcbda92c45a862555db3d01e4bf05981bed03235a3e0cb5eb58cc58da74c57d"
[metadata.files]
altgraph = []
@@ -500,6 +512,7 @@ packaging = []
pandas = []
pefile = []
pillow = []
+platformdirs = []
pyinstaller = []
pyinstaller-hooks-contrib = []
pyparsing = []
diff --git a/pyproject.toml b/pyproject.toml
index 8d4d211..f19224e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -17,6 +17,7 @@ ttkwidgets = "^0.13.0"
sentry-sdk = "^1.23.1"
darkdetect = "^0.8.0"
python-docx = "^0.8.11"
+platformdirs = "^3.5.1"
[tool.poetry.dev-dependencies]
diff --git a/requirements.txt b/requirements.txt
index 04cd147..f091674 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -16,6 +16,7 @@ packaging==23.1; python_version >= "3.8"
pandas==2.0.0; python_version >= "3.8"
pefile==2023.2.7; python_version >= "3.7" and python_version < "3.12" and sys_platform == "win32" and python_full_version >= "3.6.0"
pillow==9.5.0; python_version >= "3.7"
+platformdirs==3.5.1; python_version >= "3.7"
pyinstaller-hooks-contrib==2023.3; python_version >= "3.7" and python_version < "3.12"
pyinstaller==5.11.0; python_version >= "3.7" and python_version < "3.12"
pyparsing==3.0.9; python_full_version >= "3.6.8" and python_version >= "3.8"