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/components/text.ui | 439 +++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 367 insertions(+), 72 deletions(-)
(limited to 'src/components/text.ui')
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
From 060a7dc2d263c0fd0e36e162943b8946df937bbd Mon Sep 17 00:00:00 2001
From: tassaron
Date: Mon, 7 Aug 2017 21:03:01 -0400
Subject: dropshadow option for Text component
---
src/components/text.py | 16 ++++++++++++++--
src/components/text.ui | 27 +++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)
(limited to 'src/components/text.ui')
diff --git a/src/components/text.py b/src/components/text.py
index f88f373..c50c812 100644
--- a/src/components/text.py
+++ b/src/components/text.py
@@ -1,4 +1,4 @@
-from PIL import Image, ImageDraw
+from PIL import ImageEnhance, ImageFilter, ImageChops
from PyQt5.QtGui import QColor, QFont
from PyQt5 import QtGui, QtCore, QtWidgets
import os
@@ -153,7 +153,19 @@ class Component(Component):
image.setFont(font)
image.setPen(self.textColor)
image.drawText(x, y, self.title)
- return image.finalize()
+
+ # turn QImage into Pillow frame
+ frame = image.finalize()
+ if self.shadow:
+ shadImg = ImageEnhance.Contrast(frame).enhance(0.0)
+ shadImg = shadImg.filter(ImageFilter.GaussianBlur(self.shadBlur))
+ shadImg = ImageChops.offset(shadImg, self.shadX, self.shadY)
+ shadImg.paste(frame, box=(0, 0), mask=frame)
+ frame = shadImg
+
+ return frame
+
+
def commandHelp(self):
print('Enter a string to use as centred white text:')
diff --git a/src/components/text.ui b/src/components/text.ui
index 5a7e831..13d3467 100644
--- a/src/components/text.ui
+++ b/src/components/text.ui
@@ -563,6 +563,15 @@
0
+
+ -1000
+
+
+ 1000
+
+
+ -4
+
-
@@ -573,6 +582,15 @@
0
+
+ -1000
+
+
+ 1000
+
+
+ 8
+
-
@@ -596,6 +614,15 @@
0
+
+ 99.000000000000000
+
+
+ 0.100000000000000
+
+
+ 5.000000000000000
+
-
--
cgit v1.2.3