diff --git a/.github/workflows/conda-pyinstaller.yaml b/.github/workflows/conda-pyinstaller.yaml new file mode 100644 index 0000000..d655f46 --- /dev/null +++ b/.github/workflows/conda-pyinstaller.yaml @@ -0,0 +1,33 @@ +name: Setup Conda and Run PyInstaller + +on: [push, pull_request] + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: 3.11 # Specify the Python version you need + activate-environment: myenv + #environment-file: environment.yml # Optional: if you have an environment file + auto-update-conda: true + + - name: Install dependencies + run: | + conda install -c conda-forge fiona gdal openpyxl matplotlib click pyqt mamba geopandas pyinstaller + + - name: Run PyInstaller + run: | + pyinstaller tk_main.py tk_main.spec + + - name: Archive build artifacts + uses: actions/upload-artifact@v4 + with: + name: pyinstaller-artifacts + path: dist/ # Adjust the path according to where PyInstaller outputs the files diff --git a/tk_main.py b/tk_main.py new file mode 100644 index 0000000..12417be --- /dev/null +++ b/tk_main.py @@ -0,0 +1,48 @@ +import tkinter as tk +from tkinter import filedialog, messagebox +import pandas as pd +from tkinter import ttk + + +class App(tk.Tk): + def __init__(self): + super().__init__() + self.title("File Loader") + self.geometry("800x600") + + self.btn_load_file = tk.Button(self, text="Load File", command=self.load_file) + self.btn_load_file.pack(pady=20) + + self.table_frame = tk.Frame(self) + self.table_frame.pack(fill=tk.BOTH, expand=True) + + def load_file(self): + file_path = filedialog.askopenfilename(filetypes=[("CSV Files", "*.csv"), ("All Files", "*.*")]) + if file_path: + self.load_data(file_path) + + def load_data(self, file_path): + try: + data = pd.read_csv(file_path) + self.display_table(data) + except Exception as e: + messagebox.showerror("Error", f"Failed to load file:\n{e}") + + def display_table(self, data): + for widget in self.table_frame.winfo_children(): + widget.destroy() + + tree = ttk.Treeview(self.table_frame, columns=list(data.columns), show="headings") + tree.pack(fill=tk.BOTH, expand=True) + + for col in data.columns: + tree.heading(col, text=col) + tree.column(col, anchor=tk.W) + + for index, row in data.iterrows(): + tree.insert("", tk.END, values=list(row)) + + +if __name__ == "__main__": + app = App() + app.mainloop() diff --git a/tk_main.spec b/tk_main.spec new file mode 100644 index 0000000..debc613 --- /dev/null +++ b/tk_main.spec @@ -0,0 +1,38 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['tk_main.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, + optimize=0, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.datas, + [], + name='tk_main', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=False, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +)