Geometry general prefs

This commit is contained in:
David Robertson
2020-05-09 16:21:21 +01:00
parent 31d0cfbdd7
commit 9f2991c003
5 changed files with 52 additions and 126 deletions

View File

@@ -31,12 +31,12 @@ class OptionUI:
class BasicOptionUI(OptionUI):
"""Abstract OptionUI that has a label on the left then some other widget on the right"""
def __init__(self, option: str, label_text: str, label_tooltip: Union[str, None] = None, label_bold: bool = False, label_red: bool = False):
def __init__(self, option: str, label_text: str, label_tooltip: Union[str, None] = None, label_bold: bool = False, label_color: Union[str, None] = None):
super().__init__(option=option)
self.label_text = label_text
self.label_tooltip = label_tooltip
self.label_bold = label_bold
self.label_red = label_red
self.label_color = label_color
self.label_widget = self.build_label_widget()
self.entry_widget = self.build_entry_widget()
@@ -44,8 +44,8 @@ class BasicOptionUI(OptionUI):
fmt = "%s:"
if self.label_bold:
fmt = "<b>%s</b>" % fmt
if self.label_red:
fmt = "<span style=\"color:red;\">%s</span>" % fmt
if self.label_color:
fmt = "<span style=\"color:%s;\">%s</span>" % (self.label_color, fmt)
label_widget = QtWidgets.QLabel(fmt % _(self.label_text))
if self.label_tooltip is not None:
label_widget.setToolTip(_(self.label_tooltip))