aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--freeze.py51
-rw-r--r--setup.py70
-rw-r--r--src/background.png (renamed from background.png)bin45367 -> 45367 bytes
-rw-r--r--src/command.py (renamed from command.py)15
-rw-r--r--src/components/__base__.py (renamed from components/__base__.py)6
-rw-r--r--src/components/__init__.py (renamed from components/__init__.py)0
-rw-r--r--src/components/color.py (renamed from components/color.py)4
-rw-r--r--src/components/color.ui (renamed from components/color.ui)0
-rw-r--r--src/components/image.py (renamed from components/image.py)4
-rw-r--r--src/components/image.ui (renamed from components/image.ui)0
-rw-r--r--src/components/original.py (renamed from components/original.py)4
-rw-r--r--src/components/original.ui (renamed from components/original.ui)0
-rw-r--r--src/components/text.py (renamed from components/text.py)6
-rw-r--r--src/components/text.ui (renamed from components/text.ui)0
-rw-r--r--src/components/video.py (renamed from components/video.py)4
-rw-r--r--src/components/video.ui (renamed from components/video.ui)0
-rw-r--r--src/core.py (renamed from core.py)18
-rw-r--r--src/encoder-options.json (renamed from encoder-options.json)0
-rw-r--r--src/main.py (renamed from main.py)8
-rw-r--r--src/mainwindow.py (renamed from mainwindow.py)143
-rw-r--r--src/mainwindow.ui (renamed from mainwindow.ui)0
-rw-r--r--src/presetmanager.py (renamed from presetmanager.py)24
-rw-r--r--src/presetmanager.ui (renamed from presetmanager.ui)0
-rw-r--r--src/preview_thread.py (renamed from preview_thread.py)6
-rw-r--r--src/video_thread.py (renamed from video_thread.py)4
25 files changed, 200 insertions, 167 deletions
diff --git a/freeze.py b/freeze.py
new file mode 100644
index 0000000..48034dc
--- /dev/null
+++ b/freeze.py
@@ -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
+)
diff --git a/setup.py b/setup.py
index 48034dc..fde3461 100644
--- a/setup.py
+++ b/setup.py
@@ -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 + ) \ No newline at end of file
diff --git a/background.png b/src/background.png
index fb58593..fb58593 100644
--- a/background.png
+++ b/src/background.png
Binary files differ
diff --git a/command.py b/src/command.py
index 1a1e810..2f71f31 100644
--- a/command.py
+++ b/src/command.py
@@ -22,9 +22,9 @@ class Command(QtCore.QObject):
self.parser = argparse.ArgumentParser(
description='Create a visualization for an audio file',
epilog='EXAMPLE COMMAND: main.py myvideotemplate.avp '
- '-i ~/Music/song.mp3 -o ~/video.mp4 '
- '-c 0 image path=~/Pictures/thisWeeksPicture.jpg '
- '-c 1 video "preset=My Logo" -c 2 vis layout=classic')
+ '-i ~/Music/song.mp3 -o ~/video.mp4 '
+ '-c 0 image path=~/Pictures/thisWeeksPicture.jpg '
+ '-c 1 video "preset=My Logo" -c 2 vis layout=classic')
self.parser.add_argument(
'-i', '--input', metavar='SOUND',
help='input audio file')
@@ -113,10 +113,11 @@ class Command(QtCore.QObject):
if name.capitalize() in compName:
return compName
- compFileNames = [ \
- os.path.splitext(os.path.basename(
- mod.__file__))[0] \
- for mod in self.core.modules \
+ compFileNames = [
+ os.path.splitext(
+ os.path.basename(mod.__file__)
+ )[0]
+ for mod in self.core.modules
]
for i, compFileName in enumerate(compFileNames):
if name.lower() in compFileName:
diff --git a/components/__base__.py b/src/components/__base__.py
index a29d775..9b7b958 100644
--- a/components/__base__.py
+++ b/src/components/__base__.py
@@ -1,4 +1,4 @@
-from PyQt4 import QtGui, QtCore
+from PyQt5 import QtGui, QtCore, QtWidgets
from PIL import Image
import os
@@ -89,8 +89,8 @@ class Component(QtCore.QObject):
and return this as an RGB string and QPushButton stylesheet.
In a subclass apply stylesheet to any color selection widgets
'''
- dialog = QtGui.QColorDialog()
- dialog.setOption(QtGui.QColorDialog.ShowAlphaChannel, True)
+ dialog = QtWidgets.QColorDialog()
+ dialog.setOption(QtWidgets.QColorDialog.ShowAlphaChannel, True)
color = dialog.getColor()
if color.isValid():
RGBstring = '%s,%s,%s' % (
diff --git a/components/__init__.py b/src/components/__init__.py
index 8b13789..8b13789 100644
--- a/components/__init__.py
+++ b/src/components/__init__.py
diff --git a/components/color.py b/src/components/color.py
index 3b73458..f1fb2b2 100644
--- a/components/color.py
+++ b/src/components/color.py
@@ -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, QtWidgets
+from PyQt5.QtGui import QColor
from PIL.ImageQt import ImageQt
import os
from . import __base__
diff --git a/components/color.ui b/src/components/color.ui
index a9dacea..a9dacea 100644
--- a/components/color.ui
+++ b/src/components/color.ui
diff --git a/components/image.py b/src/components/image.py
index f8ae64e..3517af6 100644
--- a/components/image.py
+++ b/src/components/image.py
@@ -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__
@@ -85,7 +85,7 @@ class Component(__base__.Component):
def pickImage(self):
imgDir = self.settings.value("backgroundDir", os.path.expanduser("~"))
- filename = QtGui.QFileDialog.getOpenFileName(
+ filename, _ = QtWidgets.QFileDialog.getOpenFileName(
self.page, "Choose Image", imgDir,
"Image Files (%s)" % " ".join(self.imageFormats))
if filename:
diff --git a/components/image.ui b/src/components/image.ui
index 6df03a5..6df03a5 100644
--- a/components/image.ui
+++ b/src/components/image.ui
diff --git a/components/original.py b/src/components/original.py
index 6222157..0d5001c 100644
--- a/components/original.py
+++ b/src/components/original.py
@@ -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, QtWidgets
+from PyQt5.QtGui import QColor
import os
from . import __base__
import time
diff --git a/components/original.ui b/src/components/original.ui
index 5808653..5808653 100644
--- a/components/original.ui
+++ b/src/components/original.ui
diff --git a/components/text.py b/src/components/text.py
index 2375dcd..76961c9 100644
--- a/components/text.py
+++ b/src/components/text.py
@@ -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, QtWidgets
from PIL.ImageQt import ImageQt
import os
import io
@@ -138,7 +138,7 @@ class Component(__base__.Component):
painter.drawText(x, y, self.title)
painter.end()
- imBytes = image.bits().asstring(image.numBytes())
+ imBytes = image.bits().asstring(image.byteCount())
return Image.frombytes('RGBA', (width, height), imBytes)
diff --git a/components/text.ui b/src/components/text.ui
index 05e7f8e..05e7f8e 100644
--- a/components/text.ui
+++ b/src/components/text.ui
diff --git a/components/video.py b/src/components/video.py
index 4fced4e..70247e1 100644
--- a/components/video.py
+++ b/src/components/video.py
@@ -1,5 +1,5 @@
from PIL import Image, ImageDraw
-from PyQt4 import uic, QtGui, QtCore
+from PyQt5 import uic, QtGui, QtCore, QtWidgets
import os
import subprocess
import threading
@@ -180,7 +180,7 @@ class Component(__base__.Component):
def pickVideo(self):
imgDir = self.settings.value("backgroundDir", os.path.expanduser("~"))
- filename = QtGui.QFileDialog.getOpenFileName(
+ filename, _ = QtWidgets.QFileDialog.getOpenFileName(
self.page, "Choose Video",
imgDir, "Video Files (%s)" % " ".join(self.videoFormats)
)
diff --git a/components/video.ui b/src/components/video.ui
index f05e8a5..f05e8a5 100644
--- a/components/video.ui
+++ b/src/components/video.ui
diff --git a/core.py b/src/core.py
index b51cf98..c80d60e 100644
--- a/core.py
+++ b/src/core.py
@@ -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
@@ -178,8 +179,7 @@ class Core():
clearThis = False
# add loaded named presets to savedPresets dict
- if 'preset' in preset and \
- preset['preset'] is not None:
+ if 'preset' in preset and preset['preset'] is not None:
nam = preset['preset']
filepath2 = os.path.join(
self.presetDir, name, str(vers), nam)
@@ -200,8 +200,7 @@ class Core():
break
try:
- if 'preset' in preset and \
- preset['preset'] is not None:
+ if 'preset' in preset and preset['preset'] is not None:
self.selectedComponents[i].loadPreset(
preset
)
@@ -331,8 +330,7 @@ class Core():
return False
def createPresetFile(
- self, compName, vers, presetName,
- saveValueStore, filepath=''):
+ self, compName, vers, presetName, saveValueStore, filepath=''):
'''Create a preset file (.avl) at filepath using args.
Or if filepath is empty, create an internal preset using args'''
if not filepath:
diff --git a/encoder-options.json b/src/encoder-options.json
index 78bc940..78bc940 100644
--- a/encoder-options.json
+++ b/src/encoder-options.json
diff --git a/main.py b/src/main.py
index 715e433..a8dd562 100644
--- a/main.py
+++ b/src/main.py
@@ -1,4 +1,4 @@
-from PyQt4 import QtGui, uic
+from PyQt5 import QtGui, uic, QtWidgets
import sys
import os
@@ -48,9 +48,9 @@ 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")
+ # app.setOrganizationName("audio-visualizer")
if mode == 'cmd':
from command import *
@@ -71,7 +71,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))
diff --git a/mainwindow.py b/src/mainwindow.py
index cdc2a51..7a9e397 100644
--- a/mainwindow.py
+++ b/src/mainwindow.py
@@ -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
@@ -116,7 +116,6 @@ class MainWindow(QtGui.QMainWindow):
codec = window.comboBox_videoCodec.itemText(i)
if codec == self.settings.value('outputVideoCodec'):
window.comboBox_videoCodec.setCurrentIndex(i)
- #print(codec)
for i in range(window.comboBox_audioCodec.count()):
codec = window.comboBox_audioCodec.itemText(i)
@@ -146,10 +145,11 @@ class MainWindow(QtGui.QMainWindow):
# Make component buttons
self.compMenu = QMenu()
+ self.compActions = []
for i, comp in enumerate(self.core.modules):
action = self.compMenu.addAction(comp.Component.__doc__)
- action.triggered[()].connect(
- lambda item=i: self.core.insertComponent(0, item, self))
+ action.triggered.connect(
+ lambda _, item=i: self.core.insertComponent(0, item, self))
self.window.pushButton_addComponent.setMenu(self.compMenu)
@@ -160,12 +160,10 @@ class MainWindow(QtGui.QMainWindow):
self.window.pushButton_removeComponent.clicked.connect(
lambda _: self.removeComponent())
- componentList.setContextMenuPolicy(
- QtCore.Qt.CustomContextMenu)
- componentList.connect(
- componentList,
- QtCore.SIGNAL("customContextMenuRequested(QPoint)"),
- self.componentContextMenu)
+ componentList.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
+ componentList.customContextMenuRequested.connect(
+ self.componentContextMenu
+ )
currentRes = str(self.settings.value('outputWidth'))+'x' + \
str(self.settings.value('outputHeight'))
@@ -188,19 +186,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 +241,38 @@ 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)
-
- QtGui.QShortcut("Ctrl+T", self.window, activated=lambda:
- self.window.pushButton_addComponent.click())
- QtGui.QShortcut("Ctrl+Space", self.window, activated=lambda:
- self.window.listWidget_componentList.setFocus())
- QtGui.QShortcut("Ctrl+Shift+S", self.window,
- self.presetManager.openSavePresetDialog)
- QtGui.QShortcut("Ctrl+Shift+C", self.window,
- self.presetManager.clearPreset)
-
- QtGui.QShortcut("Ctrl+Up", self.window,
- activated=lambda: self.moveComponent(-1))
- QtGui.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+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)
+
+ QtWidgets.QShortcut(
+ "Ctrl+T", self.window,
+ activated=lambda: self.window.pushButton_addComponent.click()
+ )
+ QtWidgets.QShortcut(
+ "Ctrl+Space", self.window,
+ activated=lambda: self.window.listWidget_componentList.setFocus()
+ )
+ QtWidgets.QShortcut(
+ "Ctrl+Shift+S", self.window,
+ self.presetManager.openSavePresetDialog
+ )
+ QtWidgets.QShortcut(
+ "Ctrl+Shift+C", self.window, self.presetManager.clearPreset
+ )
+
+ QtWidgets.QShortcut(
+ "Ctrl+Up", self.window,
+ activated=lambda: self.moveComponent(-1)
+ )
+ QtWidgets.QShortcut(
+ "Ctrl+Down", self.window,
+ activated=lambda: self.moveComponent(1)
+ )
+ 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()
@@ -283,7 +292,7 @@ class MainWindow(QtGui.QMainWindow):
def updateComponentTitle(self, pos, presetStore=False):
if type(presetStore) == dict:
name = presetStore['preset']
- if name == None or name not in self.core.savedPresets:
+ if name is None or name not in self.core.savedPresets:
modified = False
else:
modified = (presetStore != self.core.savedPresets[name])
@@ -365,21 +374,22 @@ class MainWindow(QtGui.QMainWindow):
def openInputFileDialog(self):
inputDir = self.settings.value("inputDir", os.path.expanduser("~"))
- fileName = QtGui.QFileDialog.getOpenFileName(
+ fileName, _ = QtWidgets.QFileDialog.getOpenFileName(
self.window, "Open Audio File",
inputDir, "Audio Files (%s)" % " ".join(self.core.audioFormats))
- if not fileName == "":
+ if fileName:
self.settings.setValue("inputDir", os.path.dirname(fileName))
self.window.lineEdit_audioFile.setText(fileName)
def openOutputFileDialog(self):
outputDir = self.settings.value("outputDir", os.path.expanduser("~"))
- fileName = QtGui.QFileDialog.getSaveFileName(
+ fileName, _ = QtWidgets.QFileDialog.getSaveFileName(
self.window, "Set Output Video File",
outputDir,
- "Video Files (%s);; All Files (*)" % " ".join(self.core.videoFormats))
+ "Video Files (%s);; All Files (*)" % " ".join(
+ self.core.videoFormats))
if not fileName == "":
self.settings.setValue("outputDir", os.path.dirname(fileName))
@@ -550,13 +560,13 @@ class MainWindow(QtGui.QMainWindow):
'''Drop event for the component listwidget'''
componentList = self.window.listWidget_componentList
- modelIndexes = [ \
- componentList.model().index(i) \
- for i in range(componentList.count()) \
+ modelIndexes = [
+ componentList.model().index(i)
+ for i in range(componentList.count())
]
- rects = [ \
- componentList.visualRect(modelIndex) \
- for modelIndex in modelIndexes \
+ rects = [
+ componentList.visualRect(modelIndex)
+ for modelIndex in modelIndexes
]
rowPos = [rect.contains(event.pos()) for rect in rects]
@@ -605,9 +615,10 @@ class MainWindow(QtGui.QMainWindow):
if self.autosaveExists(identical=False):
ch = self.showMessage(
msg="You have unsaved changes in project '%s'. "
- "Save before %s?" % \
- (os.path.basename(self.currentProject)[:-4],
- phrase),
+ "Save before %s?" % (
+ os.path.basename(self.currentProject)[:-4],
+ phrase
+ ),
showCancel=True)
if ch:
success = self.saveProjectChanges()
@@ -616,7 +627,7 @@ class MainWindow(QtGui.QMainWindow):
os.remove(self.autosavePath)
def openSaveProjectDialog(self):
- filename = QtGui.QFileDialog.getSaveFileName(
+ filename, _ = QtWidgets.QFileDialog.getSaveFileName(
self.window, "Create Project File",
self.settings.value("projectDir"),
"Project Files (*.avp)")
@@ -631,7 +642,7 @@ class MainWindow(QtGui.QMainWindow):
self.core.createProjectFile(filename)
def openOpenProjectDialog(self):
- filename = QtGui.QFileDialog.getOpenFileName(
+ filename, _ = QtWidgets.QFileDialog.getOpenFileName(
self.window, "Open Project File",
self.settings.value("projectDir"),
"Project Files (*.avp)")
@@ -660,17 +671,19 @@ class MainWindow(QtGui.QMainWindow):
def showMessage(self, **kwargs):
parent = kwargs['parent'] if 'parent' in kwargs else self.window
- msg = QtGui.QMessageBox(parent)
+ msg = QtWidgets.QMessageBox(parent)
msg.setModal(True)
msg.setText(kwargs['msg'])
msg.setIcon(
- kwargs['icon'] if 'icon' in kwargs else QtGui.QMessageBox.Information)
+ kwargs['icon']
+ if 'icon' in kwargs else QtWidgets.QMessageBox.Information
+ )
msg.setDetailedText(kwargs['detail'] if 'detail' in kwargs else None)
if 'showCancel'in kwargs and kwargs['showCancel']:
msg.setStandardButtons(
- QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel)
+ QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
else:
- msg.setStandardButtons(QtGui.QMessageBox.Ok)
+ msg.setStandardButtons(QtWidgets.QMessageBox.Ok)
ch = msg.exec_()
if ch == 1024:
return True
@@ -690,7 +703,7 @@ class MainWindow(QtGui.QMainWindow):
return
self.presetManager.findPresets()
- self.menu = QtGui.QMenu()
+ self.menu = QMenu()
menuItem = self.menu.addAction("Save Preset")
menuItem.triggered.connect(
self.presetManager.openSavePresetDialog
@@ -698,8 +711,10 @@ class MainWindow(QtGui.QMainWindow):
# submenu for opening presets
try:
- presets = self.presetManager.presets[str(self.core.selectedComponents[index])]
- self.submenu = QtGui.QMenu("Open Preset")
+ presets = self.presetManager.presets[
+ str(self.core.selectedComponents[index])
+ ]
+ self.submenu = QMenu("Open Preset")
self.menu.addMenu(self.submenu)
for version, presetName in presets:
diff --git a/mainwindow.ui b/src/mainwindow.ui
index 4a12fd5..4a12fd5 100644
--- a/mainwindow.ui
+++ b/src/mainwindow.ui
diff --git a/presetmanager.py b/src/presetmanager.py
index 1720b5c..44203e5 100644
--- a/presetmanager.py
+++ b/src/presetmanager.py
@@ -1,11 +1,11 @@
-from PyQt4 import QtGui, QtCore
+from PyQt5 import 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
@@ -52,8 +52,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(
@@ -136,11 +136,11 @@ class PresetManager(QtGui.QDialog):
while True:
index = componentList.currentRow()
currentPreset = selectedComponents[index].currentPreset
- newName, OK = QtGui.QInputDialog.getText(
+ newName, OK = QtWidgets.QInputDialog.getText(
self.parent.window,
'Audio Visualizer',
'New Preset Name:',
- QtGui.QLineEdit.Normal,
+ QtWidgets.QLineEdit.Normal,
currentPreset
)
if OK:
@@ -175,7 +175,7 @@ class PresetManager(QtGui.QDialog):
msg="%s already exists! Overwrite it?" %
os.path.basename(path),
showCancel=True,
- icon=QtGui.QMessageBox.Warning,
+ icon=QtWidgets.QMessageBox.Warning,
parent=window)
if not ch:
# user clicked cancel
@@ -208,7 +208,7 @@ class PresetManager(QtGui.QDialog):
ch = self.parent.showMessage(
msg='Really delete %s?' % name,
showCancel=True,
- icon=QtGui.QMessageBox.Warning,
+ icon=QtWidgets.QMessageBox.Warning,
parent=self.window
)
if not ch:
@@ -235,11 +235,11 @@ class PresetManager(QtGui.QDialog):
while True:
index = presetList.currentRow()
- newName, OK = QtGui.QInputDialog.getText(
+ newName, OK = QtWidgets.QInputDialog.getText(
self.window,
'Preset Manager',
'Rename Preset:',
- QtGui.QLineEdit.Normal,
+ QtWidgets.QLineEdit.Normal,
self.presetRows[index][2]
)
if OK:
@@ -262,7 +262,7 @@ class PresetManager(QtGui.QDialog):
break
def openImportDialog(self):
- filename = QtGui.QFileDialog.getOpenFileName(
+ filename, _ = QtWidgets.QFileDialog.getOpenFileName(
self.window, "Import Preset File",
self.settings.value("presetDir"),
"Preset Files (*.avl)")
@@ -287,7 +287,7 @@ class PresetManager(QtGui.QDialog):
def openExportDialog(self):
if not self.window.listWidget_presets.selectedItems():
return
- filename = QtGui.QFileDialog.getSaveFileName(
+ filename, _ = QtWidgets.QFileDialog.getSaveFileName(
self.window, "Export Preset",
self.settings.value("presetDir"),
"Preset Files (*.avl)")
diff --git a/presetmanager.ui b/src/presetmanager.ui
index 5257b1c..5257b1c 100644
--- a/presetmanager.ui
+++ b/src/presetmanager.ui
diff --git a/preview_thread.py b/src/preview_thread.py
index eabf715..4a46d51 100644
--- a/preview_thread.py
+++ b/src/preview_thread.py
@@ -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,
diff --git a/video_thread.py b/src/video_thread.py
index 8266083..b45381c 100644
--- a/video_thread.py
+++ b/src/video_thread.py
@@ -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