rm unneeded imports, work on freezing
This commit is contained in:
parent
0a9002b42c
commit
38557f29f9
|
@ -1,6 +1,11 @@
|
|||
__pycache__
|
||||
settings.ini
|
||||
build/*
|
||||
env/*
|
||||
.vscode/*
|
||||
*.mkv
|
||||
*.mp4
|
||||
*.zip
|
||||
*.tar
|
||||
*.tar.*
|
||||
*.exe
|
||||
ffmpeg
|
||||
|
|
35
freeze.py
35
freeze.py
|
@ -1,11 +1,14 @@
|
|||
from cx_Freeze import setup, Executable
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Dependencies are automatically detected, but it might need
|
||||
# fine tuning.
|
||||
|
||||
deps = [os.path.join('src', p) for p in os.listdir('src') if p]
|
||||
deps.append('ffmpeg.exe' if sys.platform == 'win32' else 'ffmpeg')
|
||||
|
||||
buildOptions = dict(
|
||||
packages=[],
|
||||
excludes=[
|
||||
"apport",
|
||||
"apt",
|
||||
|
@ -17,17 +20,21 @@ buildOptions = dict(
|
|||
"xmlrpc",
|
||||
"nose"
|
||||
],
|
||||
include_files=[
|
||||
"mainwindow.ui",
|
||||
"presetmanager.ui",
|
||||
"background.png",
|
||||
"encoder-options.json",
|
||||
"components/"
|
||||
],
|
||||
includes=[
|
||||
'numpy.core._methods',
|
||||
'numpy.lib.format'
|
||||
]
|
||||
"encodings",
|
||||
"json",
|
||||
"filecmp",
|
||||
"numpy.core._methods",
|
||||
"numpy.lib.format",
|
||||
"PyQt5.QtCore",
|
||||
"PyQt5.QtGui",
|
||||
"PyQt5.QtWidgets",
|
||||
"PyQt5.uic",
|
||||
"PIL.Image",
|
||||
"PIL.ImageQt",
|
||||
"PIL.ImageDraw",
|
||||
],
|
||||
include_files=deps,
|
||||
)
|
||||
|
||||
|
||||
|
@ -35,16 +42,16 @@ base = 'Win32GUI' if sys.platform == 'win32' else None
|
|||
|
||||
executables = [
|
||||
Executable(
|
||||
'main.py',
|
||||
'src/main.py',
|
||||
base=base,
|
||||
targetName='audio-visualizer-python'
|
||||
)
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
setup(
|
||||
name='audio-visualizer-python',
|
||||
version='1.0',
|
||||
version='2.0',
|
||||
description='GUI tool to render visualization videos of audio files',
|
||||
options=dict(build_exe=buildOptions),
|
||||
executables=executables
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from PyQt5 import uic, QtGui, QtCore, QtWidgets
|
||||
from PyQt5 import uic, QtCore, QtWidgets
|
||||
from PIL import Image
|
||||
import os
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ from PyQt5.QtGui import QPainter, QColor, QFont
|
|||
from PyQt5 import QtGui, QtCore, QtWidgets
|
||||
from PIL.ImageQt import ImageQt
|
||||
import os
|
||||
import io
|
||||
import sys
|
||||
from . import __base__
|
||||
|
||||
|
||||
|
@ -136,6 +136,9 @@ class Component(__base__.Component):
|
|||
painter = QPainter(image)
|
||||
self.titleFont.setPixelSize(self.fontSize)
|
||||
painter.setFont(self.titleFont)
|
||||
if sys.byteorder == 'big':
|
||||
painter.setPen(QColor(*self.textColor))
|
||||
else:
|
||||
painter.setPen(QColor(*self.textColor[::-1]))
|
||||
painter.drawText(x, y, self.title)
|
||||
painter.end()
|
||||
|
|
10
src/core.py
10
src/core.py
|
@ -17,7 +17,6 @@ import string
|
|||
class Core():
|
||||
|
||||
def __init__(self):
|
||||
self.FFMPEG_BIN = self.findFfmpeg()
|
||||
self.dataDir = QStandardPaths.writableLocation(
|
||||
QStandardPaths.AppConfigLocation
|
||||
)
|
||||
|
@ -63,6 +62,7 @@ class Core():
|
|||
'*.xpm',
|
||||
])
|
||||
|
||||
self.FFMPEG_BIN = self.findFfmpeg()
|
||||
self.findComponents()
|
||||
self.selectedComponents = []
|
||||
# copies of named presets to detect modification
|
||||
|
@ -437,6 +437,14 @@ class Core():
|
|||
self.encoder_options = json.load(json_file)
|
||||
|
||||
def findFfmpeg(self):
|
||||
if getattr(sys, 'frozen', False):
|
||||
# The application is frozen
|
||||
if sys.platform == "win32":
|
||||
return os.path.join(self.wd, 'ffmpeg.exe')
|
||||
else:
|
||||
return os.path.join(self.wd, 'ffmpeg')
|
||||
|
||||
else:
|
||||
if sys.platform == "win32":
|
||||
return "ffmpeg.exe"
|
||||
else:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from PyQt5 import QtGui, uic, QtWidgets
|
||||
from PyQt5 import uic, QtWidgets
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
|
Reference in New Issue