- updated the FCLabel widget
This commit is contained in:
@@ -10,6 +10,7 @@ CHANGELOG for FlatCAM Evo beta
|
|||||||
18.04.2022
|
18.04.2022
|
||||||
|
|
||||||
- in Geometry Editor, in Copy Tool added the 2D copy-as-array feature therefore finishing this editor plugin upgrade
|
- in Geometry Editor, in Copy Tool added the 2D copy-as-array feature therefore finishing this editor plugin upgrade
|
||||||
|
- updated the FCLabel widget
|
||||||
|
|
||||||
17.04.2022
|
17.04.2022
|
||||||
|
|
||||||
|
|||||||
@@ -2970,9 +2970,36 @@ class FCLabel(QtWidgets.QLabel):
|
|||||||
right_clicked = QtCore.pyqtSignal(bool)
|
right_clicked = QtCore.pyqtSignal(bool)
|
||||||
middle_clicked = QtCore.pyqtSignal(bool)
|
middle_clicked = QtCore.pyqtSignal(bool)
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, title, color=None, color_callback=None, bold=None, parent=None):
|
||||||
|
"""
|
||||||
|
|
||||||
|
:param title: the label's text
|
||||||
|
:type title: str
|
||||||
|
:param color: text color
|
||||||
|
:type color: str
|
||||||
|
:param color_callback: function to alter the color
|
||||||
|
:type color_callback: function
|
||||||
|
:param bold: the text weight
|
||||||
|
:type bold: bool
|
||||||
|
:param parent: parent of this widget
|
||||||
|
:type parent: QtWidgets.QWidget | None
|
||||||
|
"""
|
||||||
|
|
||||||
super(FCLabel, self).__init__(parent)
|
super(FCLabel, self).__init__(parent)
|
||||||
|
|
||||||
|
if color and color_callback:
|
||||||
|
color = color_callback(color)
|
||||||
|
|
||||||
|
if isinstance(title, str):
|
||||||
|
if color and not bold:
|
||||||
|
self.setText('<span style="color:%s;">%s</span>' % (str(color), title))
|
||||||
|
elif not color and bold:
|
||||||
|
self.setText('<b>%s</b>' % title)
|
||||||
|
elif color and bold:
|
||||||
|
self.setText('<span style="color:%s;"><b>%s</b></span>' % (str(color), title))
|
||||||
|
else:
|
||||||
|
self.setText(title)
|
||||||
|
|
||||||
# for the usage of this label as a clickable label, to know that current state
|
# for the usage of this label as a clickable label, to know that current state
|
||||||
self.clicked_state = False
|
self.clicked_state = False
|
||||||
self.middle_clicked_state = False
|
self.middle_clicked_state = False
|
||||||
@@ -5380,7 +5407,7 @@ class FlatCAMActivityView(QtWidgets.QWidget):
|
|||||||
self.movie_path = movie
|
self.movie_path = movie
|
||||||
self.icon_path = icon
|
self.icon_path = icon
|
||||||
|
|
||||||
self.icon = FCLabel(self)
|
self.icon = FCLabel(parent=self)
|
||||||
self.icon.setGeometry(0, 0, 16, 12)
|
self.icon.setGeometry(0, 0, 16, 12)
|
||||||
self.movie = QtGui.QMovie(self.movie_path)
|
self.movie = QtGui.QMovie(self.movie_path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user