From bd473917c1b436e97c560695e58f7c6f6e1897f8 Mon Sep 17 00:00:00 2001 From: navanchauhan Date: Thu, 15 Jun 2023 21:28:35 +0530 Subject: noconsole + show selected file --- .github/workflows/ci.yml | 2 +- main.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7eb886..789612e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - name: Package for Windows run: | pip install -r requirements.txt - pyinstaller --add-data "assets;assets" --onefile --noconfirm --collect-data sv_ttk --name GCPyramid --icon assets/logo.jpeg main.py + pyinstaller --add-data "assets;assets" --onefile --noconfirm --collect-data sv_ttk --name GCPyramid --icon assets/logo.jpeg --windowed main.py - uses: actions/upload-artifact@v3 with: name: pyramid-scheme diff --git a/main.py b/main.py index 7ee08d7..af7bdd5 100644 --- a/main.py +++ b/main.py @@ -146,16 +146,19 @@ class CompanySelector: self.master.geometry("600x600") self.select_file_button = ttk.Button(self.master, text="Select Excel File", command=self.load_file) self.select_file_button.pack(pady=250) - + print(path.join(user_data_dir(appname, appauthor), "default.txt")) try: with open(path.join(user_data_dir(appname, appauthor), "default.txt")) as f: try: - self.df = pd.read_excel(f.read()) + fname = f.read() + self.df = pd.read_excel(fname) 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}') + os.remove(path.join(user_data_dir(appname, appauthor), "default.txt")) + self.load_file() except FileNotFoundError: None @@ -214,6 +217,12 @@ class CompanySelector: self.options_label = ttk.Label(self.master, text="Options", font='SunValleyBodyStrongFont 12 bold') self.options_label.place(x=250, y=150, width=100, height=20) + fname = open(path.join(user_data_dir(appname, appauthor), "default.txt")).read() + if len(fname) >= 35: + fname = f"...{fname[-30:]}" + self.db_label = ttk.Label(self.master, text=f"Using file: {fname}") + self.db_label.place(x=250,y=250, width=329, height=40) + self.prepared_for_string = tk.StringVar() self.prepared_for_entry = ttk.Entry(self.master, textvariable=self.prepared_for_string) self.prepared_for_entry.place(x=380,y=50,width=195,height=30) -- cgit v1.2.3