Skip to content

Commit

Permalink
Add Bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
rakshith111 committed Jul 14, 2023
1 parent ab81fa1 commit 4e33ee8
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 7 deletions.
38 changes: 38 additions & 0 deletions CopyPasta.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# tz_app.spec

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None

a = Analysis(['src/main.py'],
pathex=['src'],
binaries=[],
datas=[('src//ui_files//icons//icon.png', 'src//ui_files//icons//'),('src//ui_files//icons//title.png', 'src//ui_files//icons//') ],
hiddenimports=[],
hookspath=[],
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='CopyPasta',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
icon='src/ui_files/icons/icon.ico',
runtime_tmpdir=None,
console=False)

33 changes: 26 additions & 7 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from PyQt6.QtCore import Qt
import json
import os
import sys

from ui_generated.basic import Ui_CopyPasta
from add_widget import AddEditDialog
class MainWindow(QMainWindow, Ui_CopyPasta):
Expand All @@ -19,17 +21,34 @@ def __init__(self):
self.add_field.clicked.connect(self.show_add_dialog)
self.basic_frame_template.hide()
self.clipboard = QApplication.clipboard()
self.data_dir = r"src/user_data"
self.data_file = os.path.join(self.data_dir, "data.json")
self.huge=69
self.frames=[]
self.data_dir = os.path.join('src','user_data')
os.makedirs(self.data_dir, exist_ok=True)
self.data_file = os.path.normpath(os.path.join(self.data_dir, "data.json"))
self.huge = 69
self.frames = []
self.load_data()
self.label.setPixmap(QPixmap(r"src\ui_files\icons\title.png"))
self.label.setScaledContents(True)

self.setWindowTitle("CopyPasta")
self.setWindowIcon(QIcon(r"src\ui_files\icons\icon.png"))
self.resource_path()

def resource_path(self):
'''
Sets the path to the resource folder.
return os.path.join(base_path, relative_path)
'''
if hasattr(sys, '_MEIPASS'):

# Bundled with PyInstaller
base_path = sys._MEIPASS

self.label.setPixmap(QPixmap(os.path.join(base_path,"src","ui_files","icons","title.png")))
self.setWindowIcon(QIcon(os.path.join(base_path,"src","ui_files","icons","icon.png")))

else:
base_path = os.path.abspath(os.path.dirname(__file__))
self.label.setPixmap(QPixmap(os.path.join("src","ui_files","icons","title.png")))
self.setWindowIcon(QIcon(os.path.join("src","ui_files","icons","icon.png")))


def show_add_dialog(self):
'''
Expand Down
Binary file added src/ui_files/icons/icon.ico
Binary file not shown.

0 comments on commit 4e33ee8

Please sign in to comment.