ESS_GUIESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_openclESS_GUI_sync_sascalc
Last change
on this file since 96d82b3 was
33c0561,
checked in by Piotr Rozyczko <piotr.rozyczko@…>, 6 years ago
|
Replace Apply button menu driven functionality with additional button.
Removed Cancel.
Removed the window system context help button from all affected widgets.
SASVIEW-1239
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[4992ff2] | 1 | from PyQt5 import QtCore |
---|
| 2 | from PyQt5 import QtGui |
---|
| 3 | from PyQt5 import QtWidgets |
---|
[9290b1a] | 4 | |
---|
| 5 | import sas.sasview |
---|
| 6 | |
---|
[83eb5208] | 7 | from sas.qtgui.Plotting.UI.AddTextUI import Ui_AddText |
---|
[9290b1a] | 8 | |
---|
[4992ff2] | 9 | class AddText(QtWidgets.QDialog, Ui_AddText): |
---|
[9290b1a] | 10 | """ Simple GUI for a single line text query """ |
---|
| 11 | def __init__(self, parent=None): |
---|
| 12 | super(AddText, self).__init__(parent) |
---|
| 13 | self.setupUi(self) |
---|
[33c0561] | 14 | # disable the context help icon |
---|
| 15 | self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
---|
[9290b1a] | 16 | |
---|
| 17 | self._font = QtGui.QFont() |
---|
| 18 | self._color = "black" |
---|
| 19 | self.btnFont.clicked.connect(self.onFontChange) |
---|
| 20 | self.btnColor.clicked.connect(self.onColorChange) |
---|
| 21 | |
---|
| 22 | def text(self): |
---|
| 23 | return self.textEdit.toPlainText() |
---|
| 24 | |
---|
| 25 | def font(self): |
---|
| 26 | return self._font |
---|
| 27 | |
---|
| 28 | def color(self): |
---|
| 29 | return self._color |
---|
| 30 | |
---|
| 31 | def onFontChange(self, event): |
---|
| 32 | """ |
---|
| 33 | Pop up the standard Qt Font change dialog |
---|
| 34 | """ |
---|
[53c771e] | 35 | self._font, ok = QtWidgets.QFontDialog.getFont(parent=self) |
---|
[9290b1a] | 36 | if ok: |
---|
| 37 | self.textEdit.setFont(self._font) |
---|
| 38 | |
---|
| 39 | def onColorChange(self, event): |
---|
| 40 | """ |
---|
| 41 | Pop up the standard Qt color change dialog |
---|
| 42 | """ |
---|
| 43 | # Pick up the chosen color |
---|
[53c771e] | 44 | self._color = QtWidgets.QColorDialog.getColor(parent=self) |
---|
[9290b1a] | 45 | # Update the text control |
---|
| 46 | palette = QtGui.QPalette() |
---|
| 47 | palette.setColor(QtGui.QPalette.Text, self._color) |
---|
| 48 | self.textEdit.setPalette(palette) |
---|
| 49 | |
---|
| 50 | # Save the color as #RRGGBB |
---|
| 51 | self._color = str(self._color.name()) |
---|
Note: See
TracBrowser
for help on using the repository browser.