aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDH42017-06-23 02:39:56 -0500
committerDH42017-06-23 02:39:56 -0500
commit8c9914850e9987d4f05e8b88dedb058ffbb4f53f (patch)
tree4a188c0104bc270d033656e6af796686cc727d03
parent60d62599f785167f4c976a92fd8f19fbee4a363d (diff)
cx_freeze Path Updates
-rw-r--r--core.py8
-rw-r--r--main.py11
-rw-r--r--mainwindow.py6
-rw-r--r--preview_thread.py2
-rw-r--r--setup.py63
-rw-r--r--video_thread.py2
6 files changed, 62 insertions, 30 deletions
diff --git a/core.py b/core.py
index e4a7a6c..e5a9b70 100644
--- a/core.py
+++ b/core.py
@@ -22,7 +22,13 @@ class Core():
self.dataDir = QDesktopServices.storageLocation(
QDesktopServices.DataLocation)
self.presetDir = os.path.join(self.dataDir, 'presets')
- self.wd = os.path.dirname(os.path.realpath(__file__))
+ if getattr(sys, 'frozen', False):
+ # frozen
+ self.wd = os.path.dirname(sys.executable)
+ else:
+ # unfrozen
+ self.wd = os.path.dirname(os.path.realpath(__file__))
+
self.loadEncoderOptions()
self.videoFormats = Core.appendUppercase([
'*.mp4',
diff --git a/main.py b/main.py
index 7c0727b..08add50 100644
--- a/main.py
+++ b/main.py
@@ -52,8 +52,15 @@ if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
app.setApplicationName("audio-visualizer")
app.setOrganizationName("audio-visualizer")
- window = uic.loadUi(os.path.join(
- os.path.dirname(os.path.realpath(__file__)), "mainwindow.ui"))
+
+ if getattr(sys, 'frozen', False):
+ # frozen
+ wd = os.path.dirname(sys.executable)
+ else:
+ # unfrozen
+ wd = os.path.dirname(os.path.realpath(__file__))
+
+ window = uic.loadUi(os.path.join(wd, "mainwindow.ui"))
# window.adjustSize()
desc = QtGui.QDesktopWidget()
dpi = desc.physicalDpiX()
diff --git a/mainwindow.py b/mainwindow.py
index e1553f6..d21ca49 100644
--- a/mainwindow.py
+++ b/mainwindow.py
@@ -63,9 +63,7 @@ class MainWindow(QtGui.QMainWindow):
LoadDefaultSettings(self)
self.presetManager = PresetManager(
uic.loadUi(
- os.path.join(os.path.dirname(os.path.realpath(__file__)),
- 'presetmanager.ui')),
- self)
+ os.path.join(self.core.wd, 'presetmanager.ui')), self)
if not os.path.exists(self.dataDir):
os.makedirs(self.dataDir)
@@ -143,7 +141,7 @@ class MainWindow(QtGui.QMainWindow):
window.spinBox_aBitrate.valueChanged.connect(self.updateCodecSettings)
self.previewWindow = PreviewWindow(self, os.path.join(
- os.path.dirname(os.path.realpath(__file__)), "background.png"))
+ self.core.wd, "background.png"))
window.verticalLayout_previewWrapper.addWidget(self.previewWindow)
# Make component buttons
diff --git a/preview_thread.py b/preview_thread.py
index e3e8279..eabf715 100644
--- a/preview_thread.py
+++ b/preview_thread.py
@@ -23,7 +23,7 @@ class Worker(QtCore.QObject):
self.stackedWidget = parent.window.stackedWidget
self.background = Image.new("RGBA", (1920, 1080), (0, 0, 0, 0))
self.background.paste(Image.open(os.path.join(
- os.path.dirname(os.path.realpath(__file__)), "background.png")))
+ self.core.wd, "background.png")))
@pyqtSlot(str, list)
def createPreviewImage(self, components):
diff --git a/setup.py b/setup.py
index 0d9cbc4..48034dc 100644
--- a/setup.py
+++ b/setup.py
@@ -1,30 +1,51 @@
from cx_Freeze import setup, Executable
+import sys
# Dependencies are automatically detected, but it might need
# fine tuning.
-buildOptions = dict(packages = [], excludes = [
- "apport",
- "apt",
- "ctypes",
- "curses",
- "distutils",
- "email",
- "html",
- "http",
- "json",
- "xmlrpc",
- "nose"
- ], include_files = ["main.ui"])
-import sys
-base = 'Win32GUI' if sys.platform=='win32' else None
+buildOptions = dict(
+ packages=[],
+ excludes=[
+ "apport",
+ "apt",
+ "curses",
+ "distutils",
+ "email",
+ "html",
+ "http",
+ "xmlrpc",
+ "nose"
+ ],
+ include_files=[
+ "mainwindow.ui",
+ "presetmanager.ui",
+ "background.png",
+ "encoder-options.json",
+ "components/"
+ ],
+ includes=[
+ 'numpy.core._methods',
+ 'numpy.lib.format'
+ ]
+)
+
+
+base = 'Win32GUI' if sys.platform == 'win32' else None
executables = [
- Executable('main.py', base=base, targetName = 'audio-visualizer-python')
+ Executable(
+ 'main.py',
+ base=base,
+ targetName='audio-visualizer-python'
+ )
]
-setup(name='audio-visualizer-python',
- version = '1.0',
- description = 'a little GUI tool to render visualization videos of audio files',
- options = dict(build_exe = buildOptions),
- executables = executables)
+
+setup(
+ name='audio-visualizer-python',
+ version='1.0',
+ description='GUI tool to render visualization videos of audio files',
+ options=dict(build_exe=buildOptions),
+ executables=executables
+)
diff --git a/video_thread.py b/video_thread.py
index d7220f1..9740641 100644
--- a/video_thread.py
+++ b/video_thread.py
@@ -69,7 +69,7 @@ class Worker(QtCore.QObject):
def previewDispatch(self):
background = Image.new("RGBA", (1920, 1080), (0, 0, 0, 0))
background.paste(Image.open(os.path.join(
- os.path.dirname(os.path.realpath(__file__)), "background.png")))
+ self.core.wd, "background.png")))
background = background.resize((self.width, self.height))
while not self.stopped: