diff options
-rw-r--r-- | .github/workflows/ci.yml | 16 | ||||
-rw-r--r-- | main.py | 13 | ||||
-rw-r--r-- | main.spec | 44 |
3 files changed, 62 insertions, 11 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6570923..ad9c715 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on - runs-on: windows-latest + runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -27,9 +27,13 @@ jobs: python-version: "3.9" - name: Package for Windows run: | - pip install pyinstaller pandas xlrd openpyxl Pillow matplotlib - python -m pyinstaller --add-data "assets;assets" -w main.py - - uses: actions/upload-artifact@v3 + pip install pandas xlrd openpyxl Pillow matplotlib + - name: Package Application + uses: JackMcKew/pyinstaller-action-windows@main with: - name: pyramid-scheme - path: dist/ + path: . + + - uses: actions/upload-artifact@v2 + with: + name: my-app + path: dist/windows @@ -36,11 +36,7 @@ class CompanySelector: selected_df = self.df[self.df["Company Name"].isin(selected_companies)].sort_values(by="Weighting", ascending=False) pyramid_file_path = asksaveasfilename(defaultextension=".xlsx", filetypes=[("Excel files", "*.xlsx *.xls")]) - if not pyramid_file_path: - return - with pd.ExcelWriter(pyramid_file_path) as writer: - selected_df.to_excel(writer, index=False) image_file_path = asksaveasfilename(defaultextension=".png", filetypes=[("Image files","*.png")]) @@ -149,12 +145,19 @@ class CompanySelector: d.text((text_x, text_y), wrapped_company, font=fnt, fill=font_color) + print(image_file_path) + # Save the image if not image_file_path: return - + img.save(image_file_path) + if not pyramid_file_path: + return + + with pd.ExcelWriter(pyramid_file_path) as writer: + selected_df.to_excel(writer, index=False) self.master.quit() diff --git a/main.spec b/main.spec new file mode 100644 index 0000000..923b84d --- /dev/null +++ b/main.spec @@ -0,0 +1,44 @@ +# -*- mode: python ; coding: utf-8 -*- + + +block_cipher = None + + +a = Analysis( + ['main.py'], + pathex=[], + binaries=[], + datas=[('assets', 'assets')], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False, +) +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='main', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) |