QT5 Conversion + Directory Structure

This commit is contained in:
DH4 2017-06-23 17:38:05 -05:00
parent f3da72ea54
commit e92e9d79f9
25 changed files with 122 additions and 105 deletions

51
freeze.py Normal file
View File

@ -0,0 +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",
"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'
)
]
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
)

View File

@ -1,51 +1,19 @@
from cx_Freeze import setup, Executable
import sys
# Dependencies are automatically detected, but it might need
# fine tuning.
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'
)
]
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
)
+from setuptools import setup, find_packages
-# Dependencies are automatically detected, but it might need +setup(name='audio_visualizer_python',
-# fine tuning. + version='1.0',
-buildOptions = dict(packages = [], excludes = [ + description='a little GUI tool to render visualization \
- "apport", + videos of audio files',
- "apt", + license='MIT',
- "ctypes", + url='https://github.com/djfun/audio-visualizer-python',
- "curses", + packages=find_packages(),
- "distutils", + package_data={
- "email", + 'src': ['*'],
- "html", + },
- "http", + install_requires=['pillow-simd', 'numpy', ''],
- "json", + entry_points={
- "xmlrpc", + 'gui_scripts': [
- "nose" + 'audio-visualizer-python = avpython.main:main'
- ], include_files = ["main.ui"]) + ]
- + }
-import sys + )

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -1,4 +1,4 @@
from PyQt4 import QtGui, QtCore
from PyQt5 import QtGui, QtCore, QtWidgets
from PIL import Image
import os

View File

@ -1,6 +1,6 @@
from PIL import Image, ImageDraw
from PyQt4 import uic, QtGui, QtCore
from PyQt4.QtGui import QColor
from PyQt5 import uic, QtGui, QtCore
from PyQt5.QtGui import QColor
from PIL.ImageQt import ImageQt
import os
from . import __base__

View File

@ -1,5 +1,5 @@
from PIL import Image, ImageDraw
from PyQt4 import uic, QtGui, QtCore
from PyQt5 import uic, QtGui, QtCore, QtWidgets
import os
from . import __base__

View File

@ -1,7 +1,7 @@
import numpy
from PIL import Image, ImageDraw
from PyQt4 import uic, QtGui, QtCore
from PyQt4.QtGui import QColor
from PyQt5 import uic, QtGui, QtCore
from PyQt5.QtGui import QColor
import os
from . import __base__
import time

View File

@ -1,6 +1,6 @@
from PIL import Image, ImageDraw
from PyQt4.QtGui import QPainter, QColor, QFont
from PyQt4 import uic, QtGui, QtCore
from PyQt5.QtGui import QPainter, QColor, QFont
from PyQt5 import uic, QtGui, QtCore
from PIL.ImageQt import ImageQt
import os
import io

View File

@ -1,5 +1,5 @@
from PIL import Image, ImageDraw
from PyQt4 import uic, QtGui, QtCore
from PyQt5 import uic, QtGui, QtCore
import os
import subprocess
import threading

View File

@ -1,7 +1,7 @@
import sys
import io
import os
from PyQt4 import QtCore, QtGui, uic
from PyQt5 import QtCore, QtGui, uic
from os.path import expanduser
import subprocess as sp
import numpy
@ -11,7 +11,7 @@ import time
from collections import OrderedDict
import json
from importlib import import_module
from PyQt4.QtGui import QDesktopServices
from PyQt5.QtCore import QStandardPaths
import string
@ -19,8 +19,9 @@ class Core():
def __init__(self):
self.FFMPEG_BIN = self.findFfmpeg()
self.dataDir = QDesktopServices.storageLocation(
QDesktopServices.DataLocation)
self.dataDir = QStandardPaths.writableLocation(
QStandardPaths.AppConfigLocation
)
self.presetDir = os.path.join(self.dataDir, 'presets')
if getattr(sys, 'frozen', False):
# frozen

View File

@ -1,4 +1,4 @@
from PyQt4 import QtGui, uic
from PyQt5 import QtGui, uic, QtWidgets
import sys
import os
@ -49,7 +49,7 @@ if __name__ == "__main__":
# normal gui launch
proj = None
app = QtGui.QApplication(sys.argv)
app = QtWidgets.QApplication(sys.argv)
app.setApplicationName("audio-visualizer")
app.setOrganizationName("audio-visualizer")
@ -72,7 +72,7 @@ if __name__ == "__main__":
window = uic.loadUi(os.path.join(wd, "mainwindow.ui"))
# window.adjustSize()
desc = QtGui.QDesktopWidget()
desc = QtWidgets.QDesktopWidget()
dpi = desc.physicalDpiX()
topMargin = 0 if (dpi == 96) else int(10 * (dpi / 96))

View File

@ -1,7 +1,7 @@
from queue import Queue
from PyQt4 import QtCore, QtGui, uic
from PyQt4.QtCore import QSettings, Qt
from PyQt4.QtGui import QMenu, QShortcut
from PyQt5 import QtCore, QtGui, uic, QtWidgets
from PyQt5.QtCore import QSettings, Qt
from PyQt5.QtWidgets import QMenu, QShortcut
import sys
import os
import signal
@ -15,11 +15,11 @@ from presetmanager import PresetManager
from main import LoadDefaultSettings
class PreviewWindow(QtGui.QLabel):
class PreviewWindow(QtWidgets.QLabel):
def __init__(self, parent, img):
super(PreviewWindow, self).__init__()
self.parent = parent
self.setFrameStyle(QtGui.QFrame.StyledPanel)
self.setFrameStyle(QtWidgets.QFrame.StyledPanel)
self.pixmap = QtGui.QPixmap(img)
def paintEvent(self, event):
@ -39,14 +39,14 @@ class PreviewWindow(QtGui.QLabel):
self.repaint()
class MainWindow(QtGui.QMainWindow):
class MainWindow(QtWidgets.QMainWindow):
newTask = QtCore.pyqtSignal(list)
processTask = QtCore.pyqtSignal()
videoTask = QtCore.pyqtSignal(str, str, list)
def __init__(self, window, project):
QtGui.QMainWindow.__init__(self)
QtWidgets.QMainWindow.__init__(self)
# print('main thread id: {}'.format(QtCore.QThread.currentThreadId()))
self.window = window
@ -148,7 +148,7 @@ class MainWindow(QtGui.QMainWindow):
self.compMenu = QMenu()
for i, comp in enumerate(self.core.modules):
action = self.compMenu.addAction(comp.Component.__doc__)
action.triggered[()].connect(
action.triggered.connect(
lambda item=i: self.core.insertComponent(0, item, self))
self.window.pushButton_addComponent.setMenu(self.compMenu)
@ -162,10 +162,7 @@ class MainWindow(QtGui.QMainWindow):
componentList.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
componentList.connect(
componentList,
QtCore.SIGNAL("customContextMenuRequested(QPoint)"),
self.componentContextMenu)
componentList.customContextMenuRequested.connect(self.componentContextMenu)
currentRes = str(self.settings.value('outputWidth'))+'x' + \
str(self.settings.value('outputHeight'))
@ -188,19 +185,19 @@ class MainWindow(QtGui.QMainWindow):
self.projectMenu = QMenu()
self.window.menuButton_newProject = self.projectMenu.addAction(
"New Project")
self.window.menuButton_newProject.triggered[()].connect(
self.window.menuButton_newProject.triggered.connect(
self.createNewProject)
self.window.menuButton_openProject = self.projectMenu.addAction(
"Open Project")
self.window.menuButton_openProject.triggered[()].connect(
self.window.menuButton_openProject.triggered.connect(
self.openOpenProjectDialog)
action = self.projectMenu.addAction("Save Project")
action.triggered[()].connect(self.saveCurrentProject)
action.triggered.connect(self.saveCurrentProject)
action = self.projectMenu.addAction("Save Project As")
action.triggered[()].connect(self.openSaveProjectDialog)
action.triggered.connect(self.openSaveProjectDialog)
self.window.pushButton_projects.setMenu(self.projectMenu)
@ -243,27 +240,27 @@ class MainWindow(QtGui.QMainWindow):
self.drawPreview(True)
# Setup Hotkeys
QtGui.QShortcut("Ctrl+S", self.window, self.saveCurrentProject)
QtGui.QShortcut("Ctrl+A", self.window, self.openSaveProjectDialog)
QtGui.QShortcut("Ctrl+O", self.window, self.openOpenProjectDialog)
QtGui.QShortcut("Ctrl+N", self.window, self.createNewProject)
QtWidgets.QShortcut("Ctrl+S", self.window, self.saveCurrentProject)
QtWidgets.QShortcut("Ctrl+A", self.window, self.openSaveProjectDialog)
QtWidgets.QShortcut("Ctrl+O", self.window, self.openOpenProjectDialog)
QtWidgets.QShortcut("Ctrl+N", self.window, self.createNewProject)
QtGui.QShortcut("Ctrl+T", self.window, activated=lambda:
QtWidgets.QShortcut("Ctrl+T", self.window, activated=lambda:
self.window.pushButton_addComponent.click())
QtGui.QShortcut("Ctrl+Space", self.window, activated=lambda:
QtWidgets.QShortcut("Ctrl+Space", self.window, activated=lambda:
self.window.listWidget_componentList.setFocus())
QtGui.QShortcut("Ctrl+Shift+S", self.window,
QtWidgets.QShortcut("Ctrl+Shift+S", self.window,
self.presetManager.openSavePresetDialog)
QtGui.QShortcut("Ctrl+Shift+C", self.window,
QtWidgets.QShortcut("Ctrl+Shift+C", self.window,
self.presetManager.clearPreset)
QtGui.QShortcut("Ctrl+Up", self.window,
QtWidgets.QShortcut("Ctrl+Up", self.window,
activated=lambda: self.moveComponent(-1))
QtGui.QShortcut("Ctrl+Down", self.window,
QtWidgets.QShortcut("Ctrl+Down", self.window,
activated=lambda: self.moveComponent(1))
QtGui.QShortcut("Ctrl+Home", self.window, self.moveComponentTop)
QtGui.QShortcut("Ctrl+End", self.window, self.moveComponentBottom)
QtGui.QShortcut("Ctrl+r", self.window, self.removeComponent)
QtWidgets.QShortcut("Ctrl+Home", self.window, self.moveComponentTop)
QtWidgets.QShortcut("Ctrl+End", self.window, self.moveComponentBottom)
QtWidgets.QShortcut("Ctrl+r", self.window, self.removeComponent)
def cleanUp(self):
self.timer.stop()

View File

@ -1,11 +1,11 @@
from PyQt4 import QtGui, QtCore
from PyQt5 import QtGui, QtCore, QtWidgets
import string
import os
import core
class PresetManager(QtGui.QDialog):
class PresetManager(QtWidgets.QDialog):
def __init__(self, window, parent):
super().__init__(parent.window)
self.parent = parent
@ -41,8 +41,8 @@ class PresetManager(QtGui.QDialog):
)
# make auto-completion for search bar
self.autocomplete = QtGui.QStringListModel()
completer = QtGui.QCompleter()
self.autocomplete = QtCore.QStringListModel()
completer = QtWidgets.QCompleter()
completer.setModel(self.autocomplete)
self.window.lineEdit_search.setCompleter(completer)
self.window.lineEdit_search.textChanged.connect(

View File

@ -1,5 +1,5 @@
from PyQt4 import QtCore, QtGui, uic
from PyQt4.QtCore import pyqtSignal, pyqtSlot
from PyQt5 import QtCore, QtGui, uic
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PIL import Image
from PIL.ImageQt import ImageQt
import core
@ -25,7 +25,7 @@ class Worker(QtCore.QObject):
self.background.paste(Image.open(os.path.join(
self.core.wd, "background.png")))
@pyqtSlot(str, list)
@pyqtSlot(list)
def createPreviewImage(self, components):
dic = {
"components": components,

View File

@ -1,5 +1,5 @@
from PyQt4 import QtCore, QtGui, uic
from PyQt4.QtCore import pyqtSignal, pyqtSlot
from PyQt5 import QtCore, QtGui, uic
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PIL import Image, ImageDraw, ImageFont
from PIL.ImageQt import ImageQt
import core