- fixed a crash when creating a Document object due of changes in Qt6 (missing QtGui.Qt)

- in Document object fixed the issue with not setting selection color when in a dark theme (essentially got rid of using QPalette)
- in dark theme stylesheet changed the indent of the QCheckBox (and in Radio buttons too)
- updated the FClabel widget with some more properties
- updated the hack to make sure that the Editor sub-tools do not lose the stylesheet of the background
- updated the disabled project item color default value for the dark theme
This commit is contained in:
Marius Stanciu
2022-05-11 20:13:36 +03:00
committed by Marius
parent ab11367e3d
commit a973275f97
54 changed files with 204 additions and 180 deletions

View File

@@ -3037,12 +3037,7 @@ class FCButton(QtWidgets.QPushButton):
@color.setter
def color(self, color):
self._color = color
self.setStyleSheet("""
QPushButton
{{
color: {color};
}}
""".format(color=color))
self.setStyleSheet(".FCButton{color: %s;}" % color)
def get_value(self):
return self.isChecked()
@@ -3076,6 +3071,11 @@ class FCLabel(QtWidgets.QLabel):
super(FCLabel, self).__init__(parent)
self._color = None
self._bold = False
self._title = title
self._font_size = None
if color:
color = self.patching_text_color(color)
@@ -3105,6 +3105,38 @@ class FCLabel(QtWidgets.QLabel):
self.middle_clicked_state = False
self.right_clicked_state = False
@property
def color(self):
return self._color
@color.setter
def color(self, color):
self._color = color
self.setText('<font color="%s">%s</font>' % (str(color), self._title))
@property
def bold(self):
return self._bold
@bold.setter
def bold(self, bold):
self._bold = bold
font = QtGui.QFont()
font.setBold(True) if bold else font.setBold(False)
self.setFont(font)
@property
def font_size(self):
return self._font_size
@font_size.setter
def font_size(self, size):
self._font_size = size
font = QtGui.QFont()
if size:
font.setPointSize(size)
self.setFont(font)
def patching_text_color(self, color):
return color
@@ -3123,7 +3155,8 @@ class FCLabel(QtWidgets.QLabel):
return self.text()
def set_value(self, val):
self.setText(str(val))
self._title = str(val)
self.setText(self._title)
class FCMenu(QtWidgets.QMenu):
@@ -5635,7 +5668,7 @@ class AppInfoBar(QtWidgets.QWidget):
self.text.setText(text)
self.text.setToolTip(text)
if color:
self.text.setStyleSheet('color: %s' % str(color))
self.text.color = color
def set_status(self, text, level="info"):
level = str(level)
@@ -5703,7 +5736,7 @@ class CoordsToolbar(QtWidgets.QToolBar):
def set_color(self, color):
if color:
self.setStyleSheet('QtWidgets.QToolBar {color: %s}' % str(color))
self.setStyleSheet('QtWidgets.QToolBar {color: %s;}' % str(color))
class AppSystemTray(QtWidgets.QSystemTrayIcon):

View File

@@ -1508,11 +1508,7 @@ class ScriptObjectUI(ObjectUI):
self.autocomplete_cb.setToolTip(
_("This selects if the auto completer is enabled in the Script Editor.")
)
self.autocomplete_cb.setStyleSheet(
"""
QCheckBox {font-weight: bold; color: black}
"""
)
self.autocomplete_cb.setStyleSheet("")
h_lay.addWidget(self.autocomplete_cb)
h_lay.addStretch()
@@ -1582,11 +1578,7 @@ class DocumentObjectUI(ObjectUI):
self.autocomplete_cb.setToolTip(
_("This selects if the auto completer is enabled in the Document Editor.")
)
self.autocomplete_cb.setStyleSheet(
"""
QCheckBox {font-weight: bold; color: black}
"""
)
self.autocomplete_cb.setStyleSheet("")
h_lay.addWidget(self.autocomplete_cb)
h_lay.addStretch()

View File

@@ -35,7 +35,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
par_frame.setLayout(grid0)
# Theme selection
self.appearance_label = FCLabel('%s' % _('Theme'), bold=True)
self.appearance_label = FCLabel('%s' % _("Theme"), bold=True)
self.appearance_label.setToolTip(
_("Select a theme for the application.\n"
"It will theme the plot area.")
@@ -277,11 +277,13 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
grid1.addWidget(separator_line, 26, 0, 1, 2)
proj_item_lbl = FCLabel('%s' % _("Project Items Color"), bold=True, color='green')
grid1.addWidget(proj_item_lbl, 27, 0, 1, 2)
# ------------------------------------------------------------------
# ----------------------- Project Settings -----------------------------
# ------------------------------------------------------------------
# Light Theme
self.proj_settings_l_label = FCLabel('%s' % _("Light"), bold=True)
self.proj_settings_l_label = FCLabel('%s %s' % (_("Light"), _("Theme")), bold=True)
grid1.addWidget(self.proj_settings_l_label, 28, 0, 1, 2)
# Project Tab items color
@@ -313,7 +315,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
grid1.addWidget(separator_line, 33, 0, 1, 2)
# Dark Theme
self.proj_settings_d_label = FCLabel('%s' % _("Dark"), bold=True)
self.proj_settings_d_label = FCLabel('%s %s' % (_("Dark"), _("Theme")), bold=True)
grid1.addWidget(self.proj_settings_d_label, 34, 0, 1, 2)
# Project Tab items color

View File

@@ -114,7 +114,7 @@ QRadioButton:hover {
}
QCheckBox::indicator,
QRadioButton::indicator {
margin: 0 0 2 10;
margin: 0 0 2 0;
height: 18px;
width: 18px;
}