aboutsummaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authortassaron2017-06-07 23:22:55 -0400
committertassaron2017-06-07 23:22:55 -0400
commit292d21c20372634f4d0cabf43611d0e50386bc4c (patch)
tree28cc1ca948c4a3001a6a07f91f40dec275ba6a91 /components
parent6093e701e151af96464b564e275db4664d828a82 (diff)
added submenu for opening presets, moved code
Diffstat (limited to 'components')
-rw-r--r--components/__base__.py6
-rw-r--r--components/color.py3
-rw-r--r--components/image.py5
-rw-r--r--components/original.py3
-rw-r--r--components/text.py3
-rw-r--r--components/video.py5
6 files changed, 17 insertions, 8 deletions
diff --git a/components/__base__.py b/components/__base__.py
index 4fdf31f..b95edf4 100644
--- a/components/__base__.py
+++ b/components/__base__.py
@@ -2,6 +2,9 @@ from PyQt4 import QtGui
class Component:
+ def __init__(self):
+ self.currentPreset = None
+
def __str__(self):
return self.__doc__
@@ -72,7 +75,8 @@ class Component:
image = Image.new("RGBA", (width, height), (0,0,0,0))
return image
- def loadPreset(self, presetDict):
+ def loadPreset(self, presetDict, presetName=None):
+ self.currentPreset = presetName
# update widgets using a preset dict
def savePreset(self):
diff --git a/components/color.py b/components/color.py
index b050fbd..b13f54e 100644
--- a/components/color.py
+++ b/components/color.py
@@ -69,7 +69,8 @@ class Component(__base__.Component):
r, g, b = self.color1
return Image.new("RGBA", (width, height), (r, g, b, 255))
- def loadPreset(self, pr):
+ def loadPreset(self, pr, presetName=None):
+ self.currentPreset = presetName
self.page.lineEdit_color1.setText('%s,%s,%s' % pr['color1'])
self.page.lineEdit_color2.setText('%s,%s,%s' % pr['color2'])
diff --git a/components/image.py b/components/image.py
index f9a92ca..6ccddb6 100644
--- a/components/image.py
+++ b/components/image.py
@@ -48,7 +48,8 @@ class Component(__base__.Component):
frame.paste(image)
return frame
- def loadPreset(self, pr):
+ def loadPreset(self, pr, presetName=None):
+ self.currentPreset = presetName
self.page.lineEdit_image.setText(pr['image'])
def savePreset(self):
@@ -60,7 +61,7 @@ class Component(__base__.Component):
imgDir = self.settings.value("backgroundDir", os.path.expanduser("~"))
filename = QtGui.QFileDialog.getOpenFileName(
self.page, "Choose Image", imgDir, "Image Files (*.jpg *.png)")
- if filename:
+ if filename:
self.settings.setValue("backgroundDir", os.path.dirname(filename))
self.page.lineEdit_image.setText(filename)
self.update()
diff --git a/components/original.py b/components/original.py
index 4d0e83b..a2059d1 100644
--- a/components/original.py
+++ b/components/original.py
@@ -37,7 +37,8 @@ class Component(__base__.Component):
self.visColor = self.RGBFromString(self.page.lineEdit_visColor.text())
self.parent.drawPreview()
- def loadPreset(self, pr):
+ def loadPreset(self, pr, presetName=None):
+ self.currentPreset = presetName
self.page.lineEdit_visColor.setText('%s,%s,%s' % pr['visColor'])
btnStyle = "QPushButton { background-color : %s; outline: none; }" \
% QColor(*pr['visColor']).name()
diff --git a/components/text.py b/components/text.py
index 6cdc0dd..1725a41 100644
--- a/components/text.py
+++ b/components/text.py
@@ -78,7 +78,8 @@ class Component(__base__.Component):
x = self.xPosition - offset
return x, self.yPosition
- def loadPreset(self, pr):
+ def loadPreset(self, pr, presetName=None):
+ self.currentPreset = presetName
self.page.lineEdit_title.setText(pr['title'])
font = QFont()
font.fromString(pr['titleFont'])
diff --git a/components/video.py b/components/video.py
index f086cc0..e636224 100644
--- a/components/video.py
+++ b/components/video.py
@@ -128,7 +128,8 @@ class Component(__base__.Component):
def frameRender(self, moduleNo, arrayNo, frameNo):
return self.video.frame(frameNo)
- def loadPreset(self, pr):
+ def loadPreset(self, pr, presetName=None):
+ self.currentPreset = presetName
self.page.lineEdit_video.setText(pr['video'])
self.page.checkBox_loop.setChecked(pr['loop'])
@@ -144,7 +145,7 @@ class Component(__base__.Component):
self.page, "Choose Video",
imgDir, "Video Files (*.mp4 *.mov)"
)
- if filename:
+ if filename:
self.settings.setValue("backgroundDir", os.path.dirname(filename))
self.page.lineEdit_video.setText(filename)
self.update()