From e92e9d79f95ad67e83074ef318278c3486601eac Mon Sep 17 00:00:00 2001
From: DH4
Date: Fri, 23 Jun 2017 17:38:05 -0500
Subject: QT5 Conversion + Directory Structure
---
src/components/original.ui | 108 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
create mode 100644 src/components/original.ui
(limited to 'src/components/original.ui')
diff --git a/src/components/original.ui b/src/components/original.ui
new file mode 100644
index 0000000..5808653
--- /dev/null
+++ b/src/components/original.ui
@@ -0,0 +1,108 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 633
+ 178
+
+
+
+
+ 180
+ 0
+
+
+
+ Form
+
+
+ -
+
+
+ 4
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Visualizer Layout
+
+
+
+ -
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 5
+ 20
+
+
+
+
+ -
+
+
+ Visualizer Color
+
+
+
+ -
+
+
+
+ 32
+ 32
+
+
+
+
+
+
+
+ 32
+ 32
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
--
cgit v1.2.3
From a95ecd7e42b3e6b199f7bcdbe363faa8e765f869 Mon Sep 17 00:00:00 2001
From: tassaron
Date: Mon, 26 Jun 2017 19:07:49 -0400
Subject: added visualizer options + invalid presets get ignored
---
src/components/__base__.py | 1 +
src/components/original.py | 81 ++++++++++++++++++++++++++++-------------
src/components/original.ui | 89 ++++++++++++++++++++++++++++++++++++++++++++--
src/mainwindow.py | 1 +
src/presetmanager.py | 2 ++
5 files changed, 148 insertions(+), 26 deletions(-)
(limited to 'src/components/original.ui')
diff --git a/src/components/__base__.py b/src/components/__base__.py
index 9b04157..00601e7 100644
--- a/src/components/__base__.py
+++ b/src/components/__base__.py
@@ -11,6 +11,7 @@ class Component(QtCore.QObject):
def __init__(self, moduleIndex, compPos, core):
super().__init__()
self.currentPreset = None
+ self.canceled = False
self.moduleIndex = moduleIndex
self.compPos = compPos
self.core = core
diff --git a/src/components/original.py b/src/components/original.py
index 8450aa1..1aa72c9 100644
--- a/src/components/original.py
+++ b/src/components/original.py
@@ -20,11 +20,15 @@ class Component(__base__.Component):
def widget(self, parent):
self.parent = parent
self.visColor = (255, 255, 255)
+ self.scale = 20
+ self.y = 0
+ self.canceled = False
page = self.loadUi('original.ui')
page.comboBox_visLayout.addItem("Classic")
page.comboBox_visLayout.addItem("Split")
page.comboBox_visLayout.addItem("Bottom")
+ page.comboBox_visLayout.addItem("Top")
page.comboBox_visLayout.setCurrentIndex(0)
page.comboBox_visLayout.currentIndexChanged.connect(self.update)
page.lineEdit_visColor.setText('%s,%s,%s' % self.visColor)
@@ -33,13 +37,17 @@ class Component(__base__.Component):
% QColor(*self.visColor).name()
page.pushButton_visColor.setStyleSheet(btnStyle)
page.lineEdit_visColor.textChanged.connect(self.update)
+ page.spinBox_scale.valueChanged.connect(self.update)
+ page.spinBox_y.valueChanged.connect(self.update)
+
self.page = page
- self.canceled = False
return page
def update(self):
self.layout = self.page.comboBox_visLayout.currentIndex()
self.visColor = self.RGBFromString(self.page.lineEdit_visColor.text())
+ self.scale = self.page.spinBox_scale.value()
+ self.y = self.page.spinBox_y.value()
self.parent.drawPreview()
super().update()
@@ -51,21 +59,26 @@ class Component(__base__.Component):
% QColor(*pr['visColor']).name()
self.page.pushButton_visColor.setStyleSheet(btnStyle)
self.page.comboBox_visLayout.setCurrentIndex(pr['layout'])
+ self.page.spinBox_scale.setValue(pr['scale'])
+ self.page.spinBox_y.setValue(pr['y'])
def savePreset(self):
return {
'preset': self.currentPreset,
'layout': self.layout,
'visColor': self.visColor,
+ 'scale': self.scale,
+ 'y': self.y,
}
def previewRender(self, previewWorker):
spectrum = numpy.fromfunction(
- lambda x: 0.008*(x-128)**2, (255,), dtype="int16")
+ lambda x: float(self.scale)/2500*(x-128)**2, (255,), dtype="int16")
width = int(previewWorker.core.settings.value('outputWidth'))
height = int(previewWorker.core.settings.value('outputHeight'))
return self.drawBars(
- width, height, spectrum, self.visColor, self.layout)
+ width, height, spectrum, self.visColor, self.layout
+ )
def preFrameRender(self, **kwargs):
super().preFrameRender(**kwargs)
@@ -125,7 +138,7 @@ class Component(__base__.Component):
# filter the noise away
# y[y<80] = 0
- y = 20 * numpy.log10(y)
+ y = self.scale * numpy.log10(y)
y[numpy.isinf(y)] = 0
if lastSpectrum is not None:
@@ -168,40 +181,60 @@ class Component(__base__.Component):
im = self.blankFrame(width, height)
- if layout == 0:
- y = 0 - int(height/100*43)
+ if layout == 0: # Classic
+ y = self.y - int(height/100*43)
im.paste(imTop, (0, y), mask=imTop)
- y = 0 + int(height/100*43)
+ y = self.y + int(height/100*43)
im.paste(imBottom, (0, y), mask=imBottom)
- if layout == 1:
- y = 0 + int(height/100*10)
+ if layout == 1: # Split
+ y = self.y + int(height/100*10)
im.paste(imTop, (0, y), mask=imTop)
- y = 0 - int(height/100*10)
+ y = self.y - int(height/100*10)
im.paste(imBottom, (0, y), mask=imBottom)
- if layout == 2:
- y = 0 + int(height/100*10)
+ if layout == 2: # Bottom
+ y = self.y + int(height/100*10)
im.paste(imTop, (0, y), mask=imTop)
+ if layout == 3: # Top
+ y = self.y - int(height/100*10)
+ im.paste(imBottom, (0, y), mask=imBottom)
+
return im
def command(self, arg):
if not arg.startswith('preset=') and '=' in arg:
key, arg = arg.split('=', 1)
- if key == 'color':
- self.page.lineEdit_visColor.setText(arg)
- return
- elif key == 'layout':
- if arg == 'classic':
- self.page.comboBox_visLayout.setCurrentIndex(0)
- elif arg == 'split':
- self.page.comboBox_visLayout.setCurrentIndex(1)
- elif arg == 'bottom':
- self.page.comboBox_visLayout.setCurrentIndex(2)
- return
+ try:
+ if key == 'color':
+ self.page.lineEdit_visColor.setText(arg)
+ return
+ elif key == 'layout':
+ if arg == 'classic':
+ self.page.comboBox_visLayout.setCurrentIndex(0)
+ elif arg == 'split':
+ self.page.comboBox_visLayout.setCurrentIndex(1)
+ elif arg == 'bottom':
+ self.page.comboBox_visLayout.setCurrentIndex(2)
+ elif arg == 'top':
+ self.page.comboBox_visLayout.setCurrentIndex(3)
+ return
+ elif key == 'scale':
+ arg = int(arg)
+ self.page.spinBox_scale.setValue(arg)
+ return
+ elif key == 'y':
+ arg = int(arg)
+ self.page.spinBox_y.setValue(arg)
+ return
+ except ValueError:
+ print('You must enter a number.')
+ quit(1)
super().command(arg)
def commandHelp(self):
- print('Give a layout name:\n layout=[classic/split/bottom]')
+ print('Give a layout name:\n layout=[classic/split/bottom/top]')
print('Specify a color:\n color=255,255,255')
+ print('Visualizer scale (20 is default):\n scale=number')
+ print('Y position:\n y=number')
diff --git a/src/components/original.ui b/src/components/original.ui
index 5808653..8fa9b2b 100644
--- a/src/components/original.ui
+++ b/src/components/original.ui
@@ -34,7 +34,7 @@
- Visualizer Layout
+ Layout
@@ -57,10 +57,46 @@
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ QAbstractSpinBox::PlusMinus
+
+
+ 1
+
+
+ 20
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 5
+ 20
+
+
+
+
-
- Visualizer Color
+ Color
@@ -88,6 +124,55 @@
+ -
+
+
+ 4
+
+
-
+
+
+ Y
+
+
+
+ -
+
+
+ QAbstractSpinBox::UpDownArrows
+
+
+ -5000
+
+
+ 5000
+
+
+ 10
+
+
+ 0
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 5
+ 20
+
+
+
+
+
+
-
diff --git a/src/mainwindow.py b/src/mainwindow.py
index a406a7d..5068108 100644
--- a/src/mainwindow.py
+++ b/src/mainwindow.py
@@ -13,6 +13,7 @@ import video_thread
from presetmanager import PresetManager
from main import LoadDefaultSettings, disableWhenEncoding
+
class PreviewWindow(QtWidgets.QLabel):
def __init__(self, parent, img):
super(PreviewWindow, self).__init__()
diff --git a/src/presetmanager.py b/src/presetmanager.py
index 300b534..68679ec 100644
--- a/src/presetmanager.py
+++ b/src/presetmanager.py
@@ -79,6 +79,8 @@ class PresetManager(QtWidgets.QDialog):
continue
for preset in filenames:
compName = os.path.basename(os.path.dirname(dirpath))
+ if compName not in self.core.compNames:
+ continue
compVers = os.path.basename(dirpath)
try:
parseList.append((compName, int(compVers), preset))
--
cgit v1.2.3
From 998f74149553ac7a9e27d7c85cebceda2ef32c64 Mon Sep 17 00:00:00 2001
From: tassaron
Date: Sun, 6 Aug 2017 21:52:44 -0400
Subject: added stroke and font style options to Text component
---
src/component.py | 4 +-
src/components/image.ui | 336 +++++++++++++++++-----------------
src/components/original.ui | 2 +-
src/components/text.py | 65 +++++--
src/components/text.ui | 439 +++++++++++++++++++++++++++++++++++++--------
5 files changed, 593 insertions(+), 253 deletions(-)
(limited to 'src/components/original.ui')
diff --git a/src/component.py b/src/component.py
index 5b38473..5b6f9a7 100644
--- a/src/component.py
+++ b/src/component.py
@@ -198,7 +198,7 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass):
try:
preset = self.savePreset()
except Exception as e:
- preset = '%s occured while saving preset' % str(e)
+ preset = '%s occurred while saving preset' % str(e)
return '%s\n%s\n%s' % (
self.__class__.name, str(self.__class__.version), preset
)
@@ -275,7 +275,7 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass):
Call super().widget(*args) to create the component widget
which also auto-connects any common widgets (e.g., checkBoxes)
to self.update(). Then in a subclass connect special actions
- (e.g., pushButtons to select a file/colour) and initialize
+ (e.g., pushButtons to select a file) and initialize
'''
self.parent = parent
self.settings = parent.settings
diff --git a/src/components/image.ui b/src/components/image.ui
index e549ed0..1837b64 100644
--- a/src/components/image.ui
+++ b/src/components/image.ui
@@ -178,177 +178,177 @@
-
-
- -
-
-
-
-
-
- Stretch
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 5
- 20
-
-
-
-
- -
-
-
- Mirror
-
-
-
- -
-
-
- Rotate
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- QAbstractSpinBox::UpDownArrows
-
-
- °
-
-
- 0
-
-
- 359
-
-
- 0
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 10
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Scale
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
- -
-
-
- QAbstractSpinBox::UpDownArrows
-
-
- %
-
-
- 10
-
-
- 400
-
-
- 100
-
-
-
-
-
- -
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Color
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
+
+
-
+
+
+ Stretch
+
+
+ false
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 5
+ 20
+
+
+
+
+ -
+
+
+ Mirror
+
+
+
+ -
+
+
+ Rotate
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ QAbstractSpinBox::UpDownArrows
+
+
+ °
+
+
+ 0
+
+
+ 359
+
+
+ 0
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 10
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Scale
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ QAbstractSpinBox::UpDownArrows
+
+
+ %
+
+
+ 10
+
+
+ 400
+
+
+ 100
+
+
+
+
-
-
-
- QAbstractSpinBox::UpDownArrows
-
-
- %
-
-
- 0
-
-
- 999
-
-
- 1
-
-
- 100
-
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Color
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ QAbstractSpinBox::UpDownArrows
+
+
+ %
+
+
+ 0
+
+
+ 999
+
+
+ 1
+
+
+ 100
+
+
+
+
diff --git a/src/components/original.ui b/src/components/original.ui
index 8fa9b2b..a4d5119 100644
--- a/src/components/original.ui
+++ b/src/components/original.ui
@@ -6,7 +6,7 @@
0
0
- 633
+ 586
178
diff --git a/src/components/text.py b/src/components/text.py
index c3f3bdc..f88f373 100644
--- a/src/components/text.py
+++ b/src/components/text.py
@@ -4,22 +4,20 @@ from PyQt5 import QtGui, QtCore, QtWidgets
import os
from component import Component
-from toolkit.frame import FramePainter
+from toolkit.frame import FramePainter, PaintColor
class Component(Component):
name = 'Title Text'
version = '1.0.1'
- def __init__(self, *args):
- super().__init__(*args)
- self.titleFont = QFont()
-
def widget(self, *args):
super().widget(*args)
self.textColor = (255, 255, 255)
+ self.strokeColor = (0, 0, 0)
self.title = 'Text'
self.alignment = 1
+ self.titleFont = QFont()
self.fontSize = self.height / 13.5
self.page.comboBox_textAlign.addItem("Left")
@@ -28,6 +26,7 @@ class Component(Component):
self.page.comboBox_textAlign.setCurrentIndex(int(self.alignment))
self.page.lineEdit_textColor.setText('%s,%s,%s' % self.textColor)
+ self.page.lineEdit_strokeColor.setText('%s,%s,%s' % self.strokeColor)
self.page.spinBox_fontSize.setValue(int(self.fontSize))
self.page.lineEdit_title.setText(self.title)
@@ -43,8 +42,16 @@ class Component(Component):
'fontSize': self.page.spinBox_fontSize,
'xPosition': self.page.spinBox_xTextAlign,
'yPosition': self.page.spinBox_yTextAlign,
+ 'fontStyle': self.page.comboBox_fontStyle,
+ 'stroke': self.page.spinBox_stroke,
+ 'strokeColor': self.page.lineEdit_strokeColor,
+ 'shadow': self.page.checkBox_shadow,
+ 'shadX': self.page.spinBox_shadX,
+ 'shadY': self.page.spinBox_shadY,
+ 'shadBlur': self.page.spinBox_shadBlur,
}, colorWidgets={
'textColor': self.page.pushButton_textColor,
+ 'strokeColor': self.page.pushButton_strokeColor,
}, relativeWidgets=[
'xPosition', 'yPosition', 'fontSize',
])
@@ -52,11 +59,23 @@ class Component(Component):
def update(self):
self.titleFont = self.page.fontComboBox_titleFont.currentFont()
+ if self.page.checkBox_shadow.isChecked():
+ self.page.label_shadX.setHidden(False)
+ self.page.spinBox_shadX.setHidden(False)
+ self.page.spinBox_shadY.setHidden(False)
+ self.page.label_shadBlur.setHidden(False)
+ self.page.spinBox_shadBlur.setHidden(False)
+ else:
+ self.page.label_shadX.setHidden(True)
+ self.page.spinBox_shadX.setHidden(True)
+ self.page.spinBox_shadY.setHidden(True)
+ self.page.label_shadBlur.setHidden(True)
+ self.page.spinBox_shadBlur.setHidden(True)
super().update()
def centerXY(self):
self.setRelativeWidget('xPosition', 0.5)
- self.setRelativeWidget('yPosition', 0.5)
+ self.setRelativeWidget('yPosition', 0.521)
def getXY(self):
'''Returns true x, y after considering alignment settings'''
@@ -101,13 +120,39 @@ class Component(Component):
return self.addText(self.width, self.height)
def addText(self, width, height):
+ font = self.titleFont
+ font.setPixelSize(self.fontSize)
+ font.setStyle(QFont.StyleNormal)
+ font.setWeight(QFont.Normal)
+ font.setCapitalization(QFont.MixedCase)
+ if self.fontStyle == 1:
+ font.setWeight(QFont.DemiBold)
+ if self.fontStyle == 2:
+ font.setWeight(QFont.Bold)
+ elif self.fontStyle == 3:
+ font.setStyle(QFont.StyleItalic)
+ elif self.fontStyle == 4:
+ font.setWeight(QFont.Bold)
+ font.setStyle(QFont.StyleItalic)
+ elif self.fontStyle == 5:
+ font.setStyle(QFont.StyleOblique)
+ elif self.fontStyle == 6:
+ font.setCapitalization(QFont.SmallCaps)
+
image = FramePainter(width, height)
- self.titleFont.setPixelSize(self.fontSize)
- image.setFont(self.titleFont)
- image.setPen(self.textColor)
x, y = self.getXY()
+ if self.stroke > 0:
+ outliner = QtGui.QPainterPathStroker()
+ outliner.setWidth(self.stroke)
+ path = QtGui.QPainterPath()
+ path.addText(x, y, font, self.title)
+ path = outliner.createStroke(path)
+ image.setBrush(PaintColor(*self.strokeColor))
+ image.drawPath(path)
+
+ image.setFont(font)
+ image.setPen(self.textColor)
image.drawText(x, y, self.title)
-
return image.finalize()
def commandHelp(self):
diff --git a/src/components/text.ui b/src/components/text.ui
index f76979c..5a7e831 100644
--- a/src/components/text.ui
+++ b/src/components/text.ui
@@ -16,6 +16,12 @@
-
+
+ 6
+
+
+ QLayout::SetDefaultConstraint
+
4
@@ -31,7 +37,7 @@
-
-
+
0
0
@@ -47,14 +53,10 @@
-
-
- -
-
-
-
+
0
0
@@ -67,7 +69,7 @@
-
-
+
0
0
@@ -80,8 +82,44 @@
+
+
+ -
+
+
+ 0
+
-
-
+
+
+
+ 0
+ 0
+
+
+
+ Text Layout
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 100
+ 16777215
+
+
+
+
+ -
+
Qt::Horizontal
@@ -97,7 +135,36 @@
-
-
+
+
+
+ 0
+ 0
+
+
+
+ Center Text
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 5
+ 20
+
+
+
+
+ -
+
0
@@ -105,36 +172,104 @@
- Font Size
+ X
-
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ 16777215
+
+
+
+
+ 0
+ 0
+
+
- 1
+ 0
- 500
+ 999999999
+
+
+ 0
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Y
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ 16777215
+
+
+
+ 999999999
-
-
+
-
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
Text Color
- -
-
-
-
+
+
+ 0
+ 0
+
+
32
@@ -153,27 +288,23 @@
-
-
+
Qt::Horizontal
+
+ QSizePolicy::Fixed
+
- 40
+ 5
20
-
-
- -
-
-
- 0
-
-
-
+
0
@@ -181,15 +312,34 @@
- Text Layout
+ Font Size
-
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+ 1
+
+
+ 500
+
+
-
-
+
Qt::Horizontal
@@ -205,30 +355,82 @@
-
-
+
+
+
+ 0
+ 0
+
+
- Center
+ Font Style
-
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
+
+
-
+
+ Normal
+
+
+ -
+
+ Semi-Bold
+
+
+ -
+
+ Bold
+
+
+ -
+
+ Italic
+
+
+ -
+
+ Bold Italic
+
+
+ -
+
+ Faux Italic
+
+
+ -
+
+ Small Caps
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
-
+
- 5
- 20
+ 0
+ 16777215
-
+
+ Qt::NoFocus
+
+
-
-
+
0
@@ -236,59 +438,112 @@
- X
+ Stroke
-
-
+
-
+
+ 0
+ 0
+
+
+
+ px
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Stroke Color
+
+
+
+ -
+
+
+
0
0
- 80
+ 0
16777215
-
+
+ Qt::NoFocus
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
- 0
- 0
+ 32
+ 32
-
- 0
-
-
- 999999999
+
+
-
- 0
+
+
+ 32
+ 32
+
-
-
+
Qt::Horizontal
-
- QSizePolicy::Fixed
-
- 5
+ 40
20
+
+
+ -
+
-
-
+
+
+
+ 0
+ 0
+
+
+
+ Shadow
+
+
+
+ -
+
0
@@ -296,29 +551,69 @@
- Y
+ Shadow Offset
-
-
+
0
0
-
-
- 80
- 16777215
-
+
+
+ -
+
+
+
+ 0
+ 0
+
-
- 999999999
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Shadow Blur
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Minimum
+
+
+
+ 40
+ 20
+
+
+
+
--
cgit v1.2.3