aboutsummaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/__base__.py2
-rw-r--r--components/color.py11
-rw-r--r--components/image.py14
-rw-r--r--components/original.py23
-rw-r--r--components/text.py28
-rw-r--r--components/video.py16
6 files changed, 64 insertions, 30 deletions
diff --git a/components/__base__.py b/components/__base__.py
index 5c8865d..bef7f0e 100644
--- a/components/__base__.py
+++ b/components/__base__.py
@@ -73,7 +73,7 @@ class Component(QtCore.QObject):
print(
self.__doc__, 'Usage:\n'
'Open a preset for this component:\n'
- ' "preset=Preset Name"\n')
+ ' "preset=Preset Name"')
self.commandHelp()
quit(0)
diff --git a/components/color.py b/components/color.py
index cb75839..5ffcdea 100644
--- a/components/color.py
+++ b/components/color.py
@@ -233,3 +233,14 @@ class Component(__base__.Component):
else:
self.page.lineEdit_color2.setText(RGBstring)
self.page.pushButton_color2.setStyleSheet(btnStyle)
+
+ def commandHelp(self):
+ print('Specify a color:\n color=255,255,255')
+
+ def command(self, arg):
+ if not arg.startswith('preset=') and '=' in arg:
+ key, arg = arg.split('=', 1)
+ if key == 'color':
+ self.page.lineEdit_color1.setText(arg)
+ return
+ super().command(arg)
diff --git a/components/image.py b/components/image.py
index d0e1894..f8ae64e 100644
--- a/components/image.py
+++ b/components/image.py
@@ -94,18 +94,18 @@ class Component(__base__.Component):
self.update()
def command(self, arg):
- if not arg.startswith('preset='):
- if os.path.exists(arg):
+ if not arg.startswith('preset=') and '=' in arg:
+ key, arg = arg.split('=', 1)
+ if key == 'path' and os.path.exists(arg):
try:
Image.open(arg)
- self.imagePath = arg
- self.stretched = True
- return True
+ self.page.lineEdit_image.setText(arg)
+ self.page.checkBox_stretch.setChecked(True)
+ return
except OSError as e:
print("Not a supported image format")
quit(1)
super().command(arg)
def commandHelp(self):
- print('Give a complete filepath to an image to load that '
- 'image with default settings.')
+ print('Load an image:\n path=/filepath/to/image.png')
diff --git a/components/original.py b/components/original.py
index 328d64f..6222157 100644
--- a/components/original.py
+++ b/components/original.py
@@ -184,14 +184,21 @@ class Component(__base__.Component):
return im
def command(self, arg):
- if not arg.startswith('preset='):
- if arg == 'classic':
- self.layout = 0; return
- elif arg == 'split':
- self.layout = 1; return
- elif arg == 'bottom':
- self.layout = 2; return
+ 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
super().command(arg)
def commandHelp(self):
- print('Give a layout name: classic, split, or bottom')
+ print('Give a layout name:\n layout=[classic/split/bottom]')
+ print('Specify a color:\n color=255,255,255')
diff --git a/components/text.py b/components/text.py
index 536a9ba..2375dcd 100644
--- a/components/text.py
+++ b/components/text.py
@@ -149,12 +149,28 @@ class Component(__base__.Component):
self.page.lineEdit_textColor.setText(RGBstring)
self.page.pushButton_textColor.setStyleSheet(btnStyle)
- def commandHelp(self, arg):
- print('Enter a string to use as centred white text. '
- 'Use quotes around the string to escape spaces.')
+ def commandHelp(self):
+ print('Enter a string to use as centred white text:')
+ print(' "title=User Error"')
+ print('Specify a text color:\n color=255,255,255')
+ print('Set custom x, y position:\n x=500 y=500')
def command(self, arg):
- if not arg.startswith('preset='):
- self.title = arg
- return True
+ if not arg.startswith('preset=') and '=' in arg:
+ key, arg = arg.split('=', 1)
+ if key == 'color':
+ self.page.lineEdit_textColor.setText(arg)
+ return
+ elif key == 'size':
+ self.page.spinBox_fontSize.setValue(int(arg))
+ return
+ elif key == 'x':
+ self.page.spinBox_xTextAlign.setValue(int(arg))
+ return
+ elif key == 'y':
+ self.page.spinBox_yTextAlign.setValue(int(arg))
+ return
+ elif key == 'title':
+ self.page.lineEdit_title.setText(arg)
+ return
super().command(arg)
diff --git a/components/video.py b/components/video.py
index 66c98ce..1d250bd 100644
--- a/components/video.py
+++ b/components/video.py
@@ -222,21 +222,21 @@ class Component(__base__.Component):
self.chunkSize = 4*width*height
def command(self, arg):
- if not arg.startswith('preset='):
- if os.path.exists(arg):
+ if not arg.startswith('preset=') and '=' in arg:
+ key, arg = arg.split('=', 1)
+ if key == 'path' and os.path.exists(arg):
if os.path.splitext(arg)[1] in self.core.videoFormats:
- self.videoPath = arg
- self.scale = 100
- self.loopVideo = True
- return True
+ self.page.lineEdit_video.setText(arg)
+ self.page.spinBox_scale.setValue(100)
+ self.page.checkBox_loop.setChecked(True)
+ return
else:
print("Not a supported video format")
quit(1)
super().command(arg)
def commandHelp(self):
- print('Give a complete filepath to a video to load that '
- 'video with default settings.')
+ print('Load a video:\n path=/filepath/to/video.mp4')
def scale(scale, width, height, returntype=None):
width = (float(width) / 100.0) * float(scale)