diff options
| author | DH4 | 2017-06-23 10:46:54 -0500 |
|---|---|---|
| committer | DH4 | 2017-06-23 10:46:54 -0500 |
| commit | f3da72ea5402d5cd1f865b56c0a9aa3b9f3957f4 (patch) | |
| tree | 60e3cced168d4215e9c60d9e84da365e8d90dde0 /components/text.py | |
| parent | 84ceff7f5490ac5f7e1256a16d82b3b8520cb03a (diff) | |
| parent | f8628333afc5dcb2f07f4aff2ee0d41847c0c308 (diff) | |
Merge branch 'feature-newgui' of github.com:djfun/audio-visualizer-python into feature-newgui
Diffstat (limited to 'components/text.py')
| -rw-r--r-- | components/text.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/components/text.py b/components/text.py index f8ef7b3..2375dcd 100644 --- a/components/text.py +++ b/components/text.py @@ -19,12 +19,14 @@ class Component(__base__.Component): def widget(self, parent): height = int(parent.settings.value('outputHeight')) width = int(parent.settings.value('outputWidth')) + self.parent = parent self.textColor = (255, 255, 255) self.title = 'Text' self.alignment = 1 self.fontSize = height / 13.5 - self.xPosition = width / 2 + fm = QtGui.QFontMetrics(self.titleFont) + self.xPosition = width / 2 - fm.width(self.title)/2 self.yPosition = height / 2 * 1.036 page = uic.loadUi(os.path.join( @@ -146,3 +148,29 @@ class Component(__base__.Component): return self.page.lineEdit_textColor.setText(RGBstring) self.page.pushButton_textColor.setStyleSheet(btnStyle) + + 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=') 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) |
