-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
331824c
commit 388bd24
Showing
44 changed files
with
4,155 additions
and
2,544 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,50 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import sys | ||
import os | ||
sys.path.append(os.path.join(os.path.dirname(__file__), 'src')) | ||
from PyQt5.QtWidgets import QApplication | ||
from PyQt5.Qt import Qt, QPixmap, QSplashScreen, QProgressBar, QColor, QPalette, QLabel | ||
from mainApp import App | ||
|
||
|
||
if __name__ == '__main__': | ||
# Create App | ||
app = QApplication(sys.argv) | ||
|
||
if getattr( sys, 'frozen', False ) : | ||
# running in a bundle | ||
imgDir = os.path.join(sys._MEIPASS, 'img') | ||
|
||
else: | ||
# running live | ||
imgDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'img') | ||
|
||
### -------------- | ||
|
||
# Create QMainWindow Widget | ||
ex = App(imgDir) | ||
|
||
# Execute App | ||
sys.exit(app.exec_()) | ||
|
||
|
||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
import os | ||
import sys | ||
|
||
|
||
if __name__ == '__main__': | ||
# parse input if there's `--clear[?]Data` flags | ||
import argparse | ||
parser = argparse.ArgumentParser(description='PET4L') | ||
parser.add_argument('--clearAppData', dest='clearAppData', action='store_true', | ||
help='clear all previously saved application data') | ||
parser.set_defaults(clearAppData=False) | ||
args = parser.parse_args() | ||
|
||
if getattr(sys, 'frozen', False): | ||
# running in a bundle | ||
sys.path.append(os.path.join(sys._MEIPASS, 'src')) | ||
imgDir = os.path.join(sys._MEIPASS, 'img') | ||
|
||
# if linux export qt plugins path | ||
if sys.platform == 'linux': | ||
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = os.path.join(sys._MEIPASS, 'PyQt5', 'Qt', 'plugins') | ||
|
||
else: | ||
# running live | ||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'src')) | ||
imgDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'img') | ||
|
||
from PyQt5.QtWidgets import QApplication | ||
from mainApp import App | ||
|
||
# Create App | ||
app = QApplication(sys.argv) | ||
|
||
### -------------- | ||
|
||
# Create QMainWindow Widget | ||
ex = App(imgDir, args) | ||
|
||
# Execute App | ||
app.exec_() | ||
try: | ||
app.deleteLater() | ||
except Exception as e: | ||
print(e) | ||
|
||
sys.exit() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,154 @@ | ||
# -*- mode: python -*- | ||
import sys | ||
import os | ||
import os.path | ||
import simplejson as json | ||
|
||
os_type = sys.platform | ||
block_cipher = None | ||
base_dir = os.path.dirname(os.path.realpath('__file__')) | ||
|
||
# look for version string | ||
version_str = '' | ||
with open(os.path.join(base_dir, 'src', 'version.txt')) as version_file: | ||
version_data = json.load(version_file) | ||
version_file.close() | ||
version_str = version_data["number"] + version_data["tag"] | ||
|
||
add_files = [('src/version.txt', '.'), ('img', 'img')] | ||
|
||
lib_path = next(p for p in sys.path if 'site-packages' in p) | ||
if os_type == 'win32': | ||
qt5_path = os.path.join(lib_path, 'PyQt5\\Qt\\bin') | ||
sys.path.append(qt5_path) | ||
# add file vcruntime140.dll manually, due to not including by pyinstaller | ||
found = False | ||
for p in os.environ["PATH"].split(os.pathsep): | ||
file_name = os.path.join(p, "vcruntime140.dll") | ||
if os.path.exists(file_name): | ||
found = True | ||
add_files.append((file_name, '')) | ||
print('Adding file ' + file_name) | ||
break | ||
if not found: | ||
raise Exception('File vcruntime140.dll not found in the system path.') | ||
|
||
# add bitcoin library data file | ||
add_files.append( (os.path.join(lib_path, 'bitcoin/english.txt'),'bitcoin') ) | ||
|
||
a = Analysis(['pet4l.py'], | ||
pathex=[base_dir, 'src', 'src/qt'], | ||
binaries=[], | ||
datas=add_files, | ||
hiddenimports=[], | ||
hookspath=[], | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher) | ||
|
||
pyz = PYZ(a.pure, a.zipped_data, | ||
cipher=block_cipher) | ||
|
||
exe = EXE(pyz, | ||
a.scripts, | ||
exclude_binaries=True, | ||
name='pet4l', | ||
debug=False, | ||
strip=False, | ||
upx=True, | ||
console=False, | ||
icon=os.path.join(base_dir, 'img', 'spmt.%s' % ('icns' if os_type=='darwin' else 'ico')) ) | ||
|
||
coll = COLLECT(exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
name='app') | ||
|
||
if os_type == 'darwin': | ||
app = BUNDLE(coll, | ||
name='pet4l.app', | ||
icon=os.path.join(base_dir, 'img', 'spmt.icns'), | ||
bundle_identifier=None, | ||
info_plist={'NSHighResolutionCapable': 'True'}) | ||
|
||
|
||
# Prepare bundles | ||
dist_path = os.path.join(base_dir, 'dist') | ||
app_path = os.path.join(dist_path, 'app') | ||
os.chdir(dist_path) | ||
|
||
# Copy Readme Files | ||
from shutil import copyfile | ||
print('Copying README.md') | ||
copyfile(os.path.join(base_dir, 'README.md'), 'README.md') | ||
|
||
|
||
if os_type == 'win32': | ||
# Copy Qt5 Platforms | ||
os.system('xcopy app\PyQt5\Qt\plugins\platforms app\platforms\ /i') | ||
os.chdir(base_dir) | ||
# Rename dist Dir | ||
dist_path_win = os.path.join(base_dir, 'PET4L-v' + version_str + '-Win64') | ||
os.rename(dist_path, dist_path_win) | ||
# Compress dist Dir | ||
print('Compressing Windows App Folder') | ||
os.system('"C:\\Program Files\\7-Zip\\7z.exe" a %s %s -mx0' % (dist_path_win + '.zip', dist_path_win)) | ||
|
||
|
||
if os_type == 'linux': | ||
os.chdir(base_dir) | ||
# Rename dist Dir | ||
dist_path_linux = os.path.join(base_dir, 'PET4L-v' + version_str) | ||
os.rename(dist_path, dist_path_linux) | ||
# Compress dist Dir | ||
print('Compressing Linux App Folder') | ||
os.system('tar -zcvf %s -C %s %s' % ('PET4L-v' + version_str + '-x86_64-gnu_linux.tar.gz', | ||
base_dir, 'PET4L-v' + version_str)) | ||
|
||
|
||
if os_type == 'darwin': | ||
os.chdir(base_dir) | ||
# Rename dist Dir | ||
dist_path_mac = os.path.join(base_dir, 'PET4L-v' + version_str + '-MacOSX') | ||
os.rename(dist_path, dist_path_mac) | ||
# Remove 'app' folder | ||
print("Removin 'app' folder") | ||
os.chdir(dist_path_mac) | ||
os.system('rm -rf app') | ||
os.chdir(base_dir) | ||
# Compress dist Dir | ||
print('Compressing Mac App Folder') | ||
os.system('tar -zcvf %s -C %s %s' % ('PET4L-v' + version_str + '-MacOSX.tar.gz', | ||
base_dir, 'PET4L-v' + version_str + '-MacOSX')) | ||
|
||
|
||
# -*- mode: python -*- | ||
import sys | ||
import os.path as os_path | ||
import simplejson as json | ||
|
||
os_type = sys.platform | ||
block_cipher = None | ||
base_dir = os_path.dirname(os_path.realpath('__file__')) | ||
|
||
def libModule(module, source, dest): | ||
m = __import__(module) | ||
module_path = os_path.dirname(m.__file__) | ||
del m | ||
print("libModule %s" % str(( os_path.join(module_path, source), dest ))) | ||
return ( os_path.join(module_path, source), dest ) | ||
|
||
# look for version string | ||
version_str = '' | ||
with open(os_path.join(base_dir, 'src', 'version.txt')) as version_file: | ||
version_data = json.load(version_file) | ||
version_file.close() | ||
version_str = version_data["number"] + version_data["tag"] | ||
|
||
add_files = [('src/version.txt', '.'), ('img', 'img')] | ||
add_files.append( libModule('bitcoin', 'english.txt','bitcoin') ) | ||
|
||
if os_type == 'win32': | ||
import ctypes.util | ||
l = ctypes.util.find_library('libusb-1.0.dll') | ||
if l: | ||
add_files.append( (l, '.') ) | ||
|
||
|
||
a = Analysis(['pet4l.py'], | ||
pathex=[base_dir, 'src', 'src/qt'], | ||
binaries=[], | ||
datas=add_files, | ||
hiddenimports=[], | ||
hookspath=[], | ||
runtime_hooks=[], | ||
excludes=[ 'numpy', | ||
'cryptography', | ||
'lib2to3', | ||
'pkg_resources', | ||
'distutils', | ||
'Crypto', | ||
'pyi_rth_qt5', | ||
'pytest', | ||
'scipy', | ||
'pycparser', | ||
'pydoc', | ||
'PyQt5.QtHelp', | ||
'PyQt5.QtMultimedia', | ||
'PyQt5.QtNetwork', | ||
'PyQt5.QtOpenGL', | ||
'PyQt5.QtPrintSupport', | ||
'PyQt5.QtQml', | ||
'PyQt5.QtQuick', | ||
'PyQt5.QtQuickWidgets', | ||
'PyQt5.QtSensors', | ||
'PyQt5.QtSerialPort', | ||
'PyQt5.QtSql', | ||
'PyQt5.QtSvg', | ||
'PyQt5.QtTest', | ||
'PyQt5.QtWebEngine', | ||
'PyQt5.QtWebEngineCore', | ||
'PyQt5.QtWebEngineWidgets', | ||
'PyQt5.QtXml', | ||
'win32com', | ||
'xml.dom.domreg', | ||
], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher) | ||
|
||
pyz = PYZ(a.pure, a.zipped_data, | ||
cipher=block_cipher) | ||
|
||
exe = EXE(pyz, | ||
a.scripts, | ||
exclude_binaries=True, | ||
name='PET4L', | ||
debug=False, | ||
strip=False, | ||
upx=False, | ||
console=False, | ||
icon=os_path.join(base_dir, 'img', 'spmt.%s' % ('icns' if os_type=='darwin' else 'ico')) ) | ||
|
||
coll = COLLECT(exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
name='app') | ||
|
||
if os_type == 'darwin': | ||
app = BUNDLE(coll, | ||
name='PET4L.app', | ||
icon=os_path.join(base_dir, 'img', 'spmt.icns'), | ||
bundle_identifier=None, | ||
info_plist={'NSHighResolutionCapable': 'True'}) | ||
|
||
|
||
# Prepare bundles | ||
dist_path = os_path.join(base_dir, 'dist') | ||
app_path = os_path.join(dist_path, 'app') | ||
os.chdir(dist_path) | ||
|
||
# Copy Readme Files | ||
from shutil import copyfile, copytree | ||
print('Copying README.md') | ||
copyfile(os_path.join(base_dir, 'README.md'), 'README.md') | ||
copytree(os_path.join(base_dir, 'docs'), 'docs') | ||
|
||
if os_type == 'win32': | ||
# Copy Qt5 Platforms | ||
os.system('xcopy app\PyQt5\Qt\plugins\platforms app\platforms\ /i') | ||
os.chdir(base_dir) | ||
# Rename dist Dir | ||
dist_path_win = os_path.join(base_dir, 'PET4L-v' + version_str + '-Win64') | ||
os.rename(dist_path, dist_path_win) | ||
# Compress dist Dir | ||
print('Compressing Windows App Folder') | ||
os.system('"C:\\Program Files\\7-Zip\\7z.exe" a %s %s -mx0' % (dist_path_win + '.zip', dist_path_win)) | ||
|
||
|
||
if os_type == 'linux': | ||
os.chdir(base_dir) | ||
# Rename dist Dir | ||
dist_path_linux = os_path.join(base_dir, 'PET4L-v' + version_str + '-gnu_linux') | ||
os.rename(dist_path, dist_path_linux) | ||
# Compress dist Dir | ||
print('Compressing Linux App Folder') | ||
os.system('tar -zcvf %s -C %s %s' % ('PET4L-v' + version_str + '-x86_64-gnu_linux.tar.gz', | ||
base_dir, 'PET4L-v' + version_str + '-gnu_linux')) | ||
|
||
|
||
if os_type == 'darwin': | ||
os.chdir(base_dir) | ||
# Rename dist Dir | ||
dist_path_mac = os_path.join(base_dir, 'PET4L-v' + version_str + '-MacOSX') | ||
os.rename(dist_path, dist_path_mac) | ||
# Remove 'app' folder | ||
print("Removin 'app' folder") | ||
os.chdir(dist_path_mac) | ||
os.system('rm -rf app') | ||
os.chdir(base_dir) | ||
# Compress dist Dir | ||
print('Compressing Mac App Folder') | ||
os.system('tar -zcvf %s -C %s %s' % ('PET4L-v' + version_str + '-MacOSX.tar.gz', | ||
base_dir, 'PET4L-v' + version_str + '-MacOSX')) | ||
|
||
|
Oops, something went wrong.