aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/__init__.py6
-rw-r--r--src/__main__.py4
-rw-r--r--src/component.py4
-rw-r--r--src/components/color.py4
-rw-r--r--src/components/image.py4
-rw-r--r--src/components/life.py4
-rw-r--r--src/components/original.py4
-rw-r--r--src/components/sound.py4
-rw-r--r--src/components/spectrum.py8
-rw-r--r--src/components/text.py4
-rw-r--r--src/components/video.py8
-rw-r--r--src/components/waveform.py8
-rw-r--r--src/core.py12
-rw-r--r--src/gui/actions.py2
-rw-r--r--src/gui/mainwindow.py13
-rw-r--r--src/gui/presetmanager.py6
-rw-r--r--src/gui/preview_thread.py4
-rw-r--r--src/main.py11
-rw-r--r--src/toolkit/__init__.py2
-rw-r--r--src/toolkit/ffmpeg.py8
-rw-r--r--src/toolkit/frame.py2
-rw-r--r--src/video_thread.py8
22 files changed, 64 insertions, 66 deletions
diff --git a/src/__init__.py b/src/__init__.py
index 73f174a..08131ce 100644
--- a/src/__init__.py
+++ b/src/__init__.py
@@ -3,6 +3,9 @@ import os
import logging
+__version__ = '2.0.0rc6'
+
+
class Logger(logging.getLoggerClass()):
'''
Custom Logger class to handle custom VERBOSE log level.
@@ -31,6 +34,3 @@ if getattr(sys, 'frozen', False):
else:
# unfrozen
wd = os.path.dirname(os.path.realpath(__file__))
-
-# make relative imports work when using /src as a package
-sys.path.insert(0, wd)
diff --git a/src/__main__.py b/src/__main__.py
index 3babeae..3206bc8 100644
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -1,5 +1,5 @@
-# Allows for launching with python3 -m avpython
+# Allows for launching with python3 -m avp
-from avpython.main import main
+from .main import main
main()
diff --git a/src/component.py b/src/component.py
index f3ee188..33c7657 100644
--- a/src/component.py
+++ b/src/component.py
@@ -11,8 +11,8 @@ import time
import logging
from copy import copy
-from toolkit.frame import BlankFrame
-from toolkit import (
+from .toolkit.frame import BlankFrame
+from .toolkit import (
getWidgetValue, setWidgetValue, connectWidget, rgbFromString, blockSignals
)
diff --git a/src/components/color.py b/src/components/color.py
index 7d4f86d..6336194 100644
--- a/src/components/color.py
+++ b/src/components/color.py
@@ -4,8 +4,8 @@ from PyQt5.QtGui import QColor
from PIL.ImageQt import ImageQt
import os
-from component import Component
-from toolkit.frame import BlankFrame, FloodFrame, FramePainter, PaintColor
+from ..component import Component
+from ..toolkit.frame import BlankFrame, FloodFrame, FramePainter, PaintColor
class Component(Component):
diff --git a/src/components/image.py b/src/components/image.py
index dd363bf..42f9564 100644
--- a/src/components/image.py
+++ b/src/components/image.py
@@ -2,8 +2,8 @@ from PIL import Image, ImageDraw, ImageEnhance
from PyQt5 import QtGui, QtCore, QtWidgets
import os
-from component import Component
-from toolkit.frame import BlankFrame
+from ..component import Component
+from ..toolkit.frame import BlankFrame
class Component(Component):
diff --git a/src/components/life.py b/src/components/life.py
index 7a610eb..94704bc 100644
--- a/src/components/life.py
+++ b/src/components/life.py
@@ -4,8 +4,8 @@ from PIL import Image, ImageDraw, ImageEnhance, ImageChops, ImageFilter
import os
import math
-from component import Component
-from toolkit.frame import BlankFrame, scale
+from ..component import Component
+from ..toolkit.frame import BlankFrame, scale
class Component(Component):
diff --git a/src/components/original.py b/src/components/original.py
index f886374..80228fe 100644
--- a/src/components/original.py
+++ b/src/components/original.py
@@ -6,8 +6,8 @@ import os
import time
from copy import copy
-from component import Component
-from toolkit.frame import BlankFrame
+from ..component import Component
+from ..toolkit.frame import BlankFrame
class Component(Component):
diff --git a/src/components/sound.py b/src/components/sound.py
index 18d2a65..118ea23 100644
--- a/src/components/sound.py
+++ b/src/components/sound.py
@@ -1,8 +1,8 @@
from PyQt5 import QtGui, QtCore, QtWidgets
import os
-from component import Component
-from toolkit.frame import BlankFrame
+from ..component import Component
+from ..toolkit.frame import BlankFrame
class Component(Component):
diff --git a/src/components/spectrum.py b/src/components/spectrum.py
index 6675f5b..d1f8fb6 100644
--- a/src/components/spectrum.py
+++ b/src/components/spectrum.py
@@ -6,10 +6,10 @@ import subprocess
import time
import logging
-from component import Component
-from toolkit.frame import BlankFrame, scale
-from toolkit import checkOutput, connectWidget
-from toolkit.ffmpeg import (
+from ..component import Component
+from ..toolkit.frame import BlankFrame, scale
+from ..toolkit import checkOutput, connectWidget
+from ..toolkit.ffmpeg import (
openPipe, closePipe, getAudioDuration, FfmpegVideo, exampleSound
)
diff --git a/src/components/text.py b/src/components/text.py
index 32a108e..e8c5a9c 100644
--- a/src/components/text.py
+++ b/src/components/text.py
@@ -4,8 +4,8 @@ from PyQt5 import QtGui, QtCore, QtWidgets
import os
import logging
-from component import Component
-from toolkit.frame import FramePainter, PaintColor
+from ..component import Component
+from ..toolkit.frame import FramePainter, PaintColor
log = logging.getLogger('AVP.Components.Text')
diff --git a/src/components/video.py b/src/components/video.py
index 8ad21b5..070940d 100644
--- a/src/components/video.py
+++ b/src/components/video.py
@@ -5,10 +5,10 @@ import math
import subprocess
import logging
-from component import Component
-from toolkit.frame import BlankFrame, scale
-from toolkit.ffmpeg import openPipe, closePipe, testAudioStream, FfmpegVideo
-from toolkit import checkOutput
+from ..component import Component
+from ..toolkit.frame import BlankFrame, scale
+from ..toolkit.ffmpeg import openPipe, closePipe, testAudioStream, FfmpegVideo
+from ..toolkit import checkOutput
log = logging.getLogger('AVP.Components.Video')
diff --git a/src/components/waveform.py b/src/components/waveform.py
index cbfc47f..1a6035f 100644
--- a/src/components/waveform.py
+++ b/src/components/waveform.py
@@ -6,10 +6,10 @@ import math
import subprocess
import logging
-from component import Component
-from toolkit.frame import BlankFrame, scale
-from toolkit import checkOutput
-from toolkit.ffmpeg import (
+from ..component import Component
+from ..toolkit.frame import BlankFrame, scale
+from ..toolkit import checkOutput
+from ..toolkit.ffmpeg import (
openPipe, closePipe, getAudioDuration, FfmpegVideo, exampleSound
)
diff --git a/src/core.py b/src/core.py
index d7445c9..bc6f9b4 100644
--- a/src/core.py
+++ b/src/core.py
@@ -9,12 +9,12 @@ import json
from importlib import import_module
import logging
-import toolkit
+from . import toolkit
log = logging.getLogger('AVP.Core')
STDOUT_LOGLVL = logging.WARNING
-FILE_LOGLVL = None
+FILE_LOGLVL = logging.ERROR
class Core:
@@ -47,7 +47,7 @@ class Core:
yield name
log.debug('Importing component modules')
self.modules = [
- import_module('components.%s' % name)
+ import_module('.components.%s' % name, __package__)
for name in findComponents()
]
# store canonical module names and indexes
@@ -426,7 +426,7 @@ class Core:
def newVideoWorker(self, loader, audioFile, outputPath):
'''loader is MainWindow or Command object which must own the thread'''
- import video_thread
+ from . import video_thread
self.videoThread = QtCore.QThread(loader)
videoWorker = video_thread.Worker(
loader, audioFile, outputPath, self.selectedComponents
@@ -450,8 +450,8 @@ class Core:
@classmethod
def storeSettings(cls):
'''Store settings/paths to directories as class variables'''
- from __init__ import wd
- from toolkit.ffmpeg import findFfmpeg
+ from .__init__ import wd
+ from .toolkit.ffmpeg import findFfmpeg
cls.wd = wd
dataDir = QtCore.QStandardPaths.writableLocation(
diff --git a/src/gui/actions.py b/src/gui/actions.py
index 8e867b9..eb7b953 100644
--- a/src/gui/actions.py
+++ b/src/gui/actions.py
@@ -5,7 +5,7 @@ from PyQt5.QtWidgets import QUndoCommand
import os
from copy import copy
-from core import Core
+from ..core import Core
# =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~==~=~=~=~=~=~=~=~=~=~=~=~=~=~
diff --git a/src/gui/mainwindow.py b/src/gui/mainwindow.py
index 75534c2..da8370d 100644
--- a/src/gui/mainwindow.py
+++ b/src/gui/mainwindow.py
@@ -16,12 +16,12 @@ import filecmp
import time
import logging
-from core import Core
-import gui.preview_thread as preview_thread
-from gui.preview_win import PreviewWindow
-from gui.presetmanager import PresetManager
-from gui.actions import *
-from toolkit import (
+from ..core import Core
+from . import preview_thread
+from .preview_win import PreviewWindow
+from .presetmanager import PresetManager
+from .actions import *
+from ..toolkit import (
disableWhenEncoding, disableWhenOpeningProject, checkOutput, blockSignals
)
@@ -65,7 +65,6 @@ class MainWindow(QtWidgets.QMainWindow):
self.settings = Core.settings
# Register clean-up functions
- signal.signal(signal.SIGINT, self.terminate)
atexit.register(self.cleanUp)
# Create stack of undoable user actions
diff --git a/src/gui/presetmanager.py b/src/gui/presetmanager.py
index 2445760..1e47a7f 100644
--- a/src/gui/presetmanager.py
+++ b/src/gui/presetmanager.py
@@ -7,9 +7,9 @@ import string
import os
import logging
-from toolkit import badName
-from core import Core
-from gui.actions import *
+from ..toolkit import badName
+from ..core import Core
+from .actions import *
log = logging.getLogger('AVP.Gui.PresetManager')
diff --git a/src/gui/preview_thread.py b/src/gui/preview_thread.py
index d3e0581..7829476 100644
--- a/src/gui/preview_thread.py
+++ b/src/gui/preview_thread.py
@@ -10,8 +10,8 @@ from queue import Queue, Empty
import os
import logging
-from toolkit.frame import Checkerboard
-from toolkit import disableWhenOpeningProject
+from ..toolkit.frame import Checkerboard
+from ..toolkit import disableWhenOpeningProject
log = logging.getLogger("AVP.Gui.PreviewThread")
diff --git a/src/main.py b/src/main.py
index 126e4a8..5fabda3 100644
--- a/src/main.py
+++ b/src/main.py
@@ -3,7 +3,7 @@ import sys
import os
import logging
-from __init__ import wd
+from .__init__ import wd
log = logging.getLogger('AVP.Main')
@@ -12,6 +12,7 @@ log = logging.getLogger('AVP.Main')
def main():
app = QtWidgets.QApplication(sys.argv)
app.setApplicationName("audio-visualizer")
+ proj = None
# Determine mode
mode = 'GUI'
@@ -23,19 +24,17 @@ def main():
else:
# opening a project file with gui
proj = sys.argv[1]
- else:
- # normal gui launch
- proj = None
# Launch program
if mode == 'commandline':
- from command import Command
+ from .command import Command
main = Command()
+ main.parseArgs()
log.debug("Finished creating command object")
elif mode == 'GUI':
- from gui.mainwindow import MainWindow
+ from .gui.mainwindow import MainWindow
window = uic.loadUi(os.path.join(wd, "gui", "mainwindow.ui"))
# window.adjustSize()
diff --git a/src/toolkit/__init__.py b/src/toolkit/__init__.py
index 3fca275..55e5f84 100644
--- a/src/toolkit/__init__.py
+++ b/src/toolkit/__init__.py
@@ -1 +1 @@
-from toolkit.common import *
+from .common import *
diff --git a/src/toolkit/ffmpeg.py b/src/toolkit/ffmpeg.py
index 419d491..3298c04 100644
--- a/src/toolkit/ffmpeg.py
+++ b/src/toolkit/ffmpeg.py
@@ -10,8 +10,8 @@ import signal
from queue import PriorityQueue
import logging
-import core
-from toolkit.common import checkOutput, pipeWrapper
+from .. import core
+from .common import checkOutput, pipeWrapper
log = logging.getLogger('AVP.Toolkit.Ffmpeg')
@@ -90,7 +90,7 @@ class FfmpegVideo:
self.frameBuffer.task_done()
def fillBuffer(self):
- from component import ComponentError
+ from ..component import ComponentError
if core.Core.logEnabled:
logFilename = os.path.join(
core.Core.logDir, 'render_%s.log' % str(self.component.compPos)
@@ -144,7 +144,7 @@ def openPipe(commandList, **kwargs):
def closePipe(pipe):
pipe.stdout.close()
- pipe.send_signal(signal.SIGINT)
+ pipe.send_signal(signal.SIGTERM)
def findFfmpeg():
diff --git a/src/toolkit/frame.py b/src/toolkit/frame.py
index 0e200b5..f2511fe 100644
--- a/src/toolkit/frame.py
+++ b/src/toolkit/frame.py
@@ -9,7 +9,7 @@ import os
import math
import logging
-import core
+from .. import core
log = logging.getLogger('AVP.Toolkit.Frame')
diff --git a/src/video_thread.py b/src/video_thread.py
index 0a39f28..31331a3 100644
--- a/src/video_thread.py
+++ b/src/video_thread.py
@@ -19,9 +19,9 @@ import time
import signal
import logging
-from component import ComponentError
-from toolkit.frame import Checkerboard
-from toolkit.ffmpeg import (
+from .component import ComponentError
+from .toolkit.frame import Checkerboard
+from .toolkit.ffmpeg import (
openPipe, readAudioFile,
getAudioDuration, createFfmpegCommand
)
@@ -400,7 +400,7 @@ class Worker(QtCore.QObject):
comp.cancel()
try:
- self.out_pipe.send_signal(signal.SIGINT)
+ self.out_pipe.send_signal(signal.SIGTERM)
except Exception:
pass