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