aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authortassaron2017-05-23 18:19:55 -0400
committertassaron2017-05-23 18:19:55 -0400
commita251be0cd46d3702fcbb5cabf0ff4a348b42b66e (patch)
tree93db1c684b780cf8c59863b52dcb354253ccb456 /main.py
parent431b9f63048850f6e3151b1bfd8650143f50dfe7 (diff)
select colors more easily using QColorDialog
Diffstat (limited to 'main.py')
-rw-r--r--main.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/main.py b/main.py
index 0a37351..16697d6 100644
--- a/main.py
+++ b/main.py
@@ -162,10 +162,11 @@ class Main(QtCore.QObject):
window.pushButton_selectBackground.setText("Select Background Image")
window.label_font.setText("Title Font")
window.label_alignment.setText("Title Options")
+ window.label_colorOptions.setText("Colors")
window.label_fontsize.setText("Fontsize")
window.label_title.setText("Title Text")
- window.label_textColor.setText("Text color:")
- window.label_visColor.setText("Visualizer color:")
+ window.label_textColor.setText("Text:")
+ window.label_visColor.setText("Visualizer:")
window.pushButton_createVideo.setText("Create Video")
window.groupBox_create.setTitle("Create")
window.groupBox_settings.setTitle("Settings")
@@ -179,6 +180,12 @@ class Main(QtCore.QObject):
window.textYSpinBox.setValue(375)
window.lineEdit_textColor.setText('%s,%s,%s' % self.textColor)
window.lineEdit_visColor.setText('%s,%s,%s' % self.visColor)
+ window.pushButton_textColor.clicked.connect(lambda: self.pickColor('text'))
+ window.pushButton_visColor.clicked.connect(lambda: self.pickColor('vis'))
+ btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(*self.textColor).name()
+ window.pushButton_textColor.setStyleSheet(btnStyle)
+ btnStyle = "QPushButton { background-color : %s; outline: none; }" % QColor(*self.visColor).name()
+ window.pushButton_visColor.setStyleSheet(btnStyle)
titleFont = self.settings.value("titleFont")
if not titleFont == None:
@@ -307,6 +314,18 @@ class Main(QtCore.QObject):
self.window.label_preview.setPixmap(self._previewPixmap)
+ def pickColor(self, colorTarget):
+ color = QtGui.QColorDialog.getColor()
+ if color.isValid():
+ RGBstring = '%s,%s,%s' % (str(color.red()), str(color.green()), str(color.blue()))
+ btnStyle = "QPushButton { background-color : %s; outline: none; }" % color.name()
+ if colorTarget == 'text':
+ self.window.lineEdit_textColor.setText(RGBstring)
+ window.pushButton_textColor.setStyleSheet(btnStyle)
+ elif colorTarget == 'vis':
+ self.window.lineEdit_visColor.setText(RGBstring)
+ window.pushButton_visColor.setStyleSheet(btnStyle)
+
if len(sys.argv) > 1:
# command line mode
app = QtGui.QApplication(sys.argv, False)