commit
1bb67d1513
|
@ -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
|
||||
)
|
70
setup.py
70
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 + )
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
@ -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:
|
|
@ -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' % (
|
|
@ -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__
|
|
@ -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:
|
|
@ -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
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
)
|
|
@ -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:
|
|
@ -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))
|
|
@ -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)
|
||||
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:
|
||||
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)
|
||||
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
|
||||
)
|
||||
|
||||
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+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:
|
|
@ -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)")
|
|
@ -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,
|
|
@ -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
|
Reference in New Issue