Merged in bugfix/lighting_btns_font_size (pull request #411)

bugfix/lightbuttons_font_size

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Jakub Trllo 2020-01-06 16:15:44 +00:00 committed by Milan Kolar
commit 6a186024db

View file

@ -299,14 +299,15 @@ class ComponentItem(QtWidgets.QFrame):
class LightingButton(QtWidgets.QPushButton):
lightingbtnstyle = """
QPushButton {
font: %(font_size_pt)spt;
text-align: center;
color: #777777;
background-color: transparent;
border-width: 1px;
border-color: #777777;
border-style: solid;
padding-top: 2px;
padding-bottom: 2px;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 3px;
padding-right: 3px;
border-radius: 3px;
@ -343,18 +344,13 @@ class LightingButton(QtWidgets.QPushButton):
}
"""
def __init__(self, text, *args, **kwargs):
super().__init__(text, *args, **kwargs)
self.setStyleSheet(self.lightingbtnstyle)
def __init__(self, text, font_size_pt=8, *args, **kwargs):
super(LightingButton, self).__init__(text, *args, **kwargs)
self.setStyleSheet(self.lightingbtnstyle % {
"font_size_pt": font_size_pt
})
self.setCheckable(True)
preview_font_metrics = self.fontMetrics().boundingRect(text)
width = preview_font_metrics.width() + 16
height = preview_font_metrics.height() + 5
self.setMaximumWidth(width)
self.setMaximumHeight(height)
class PngFactory:
png_names = {