Skip to content

Commit b209355

Browse files
committed
Issue #72: Node [Panel] Redesign: continued...
1 parent 12bf3c1 commit b209355

File tree

3 files changed

+92
-79
lines changed

3 files changed

+92
-79
lines changed

Lib/typerig/proxy/fl/gui/styles.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# No warranties. By using this you agree
99
# that you use it at your own risk!
1010

11-
__version__ = '0.0.2'
11+
__version__ = '0.0.3'
1212

1313
# -- CSS Styling ------------------------
1414
css_fl_button = '''
@@ -101,22 +101,30 @@
101101
QDoubleSpinBox#spn_panel {
102102
max-height: 20px;
103103
max-width: 60px;
104+
min-height: 20px;
105+
min-width: 60px;
104106
}
105107
106108
QPushButton#btn_panel_opt,
107109
QPushButton#btn_panel,
108110
QLabel#lbl_panel {
111+
/*margin: 2 0 2 0;*/
112+
/*padding: 2 0 2 0;*/
113+
background: none;
114+
border-radius: 5px;
115+
border: 1px solid transparent;
109116
color: #212121;
110117
font-family: "TypeRig Icons";
111118
font-size: 20px;
112-
background: none;
113-
border-radius: 5px;
114-
/*margin: 2 0 2 0;*/
115-
/*padding: 2 0 2 0;*/
116119
max-height: 26px;
117120
max-width: 26px;
118121
min-height: 26px;
119122
min-width: 26px;
123+
text-align: center;
124+
}
125+
126+
QLabel#lbl_panel {
127+
border: none;
120128
}
121129
122130
QPushButton#btn_panel_opt{

Lib/typerig/proxy/fl/gui/widgets.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from typerig.proxy.fl.objects.glyph import eGlyph
2727

2828
# - Init ----------------------------------
29-
__version__ = '0.3.7'
29+
__version__ = '0.3.9'
3030

3131
# - Keep compatibility for basestring checks
3232
try:
@@ -193,6 +193,7 @@ def __init__(self, button_text, init_values=(0., 100., 0., 1.), tooltip=(None, N
193193
self.box.addWidget(self.input)
194194
self.box.addWidget(self.button)
195195
self.setLayout(self.box)
196+
self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
196197

197198
# -- Sub Dialogs --------------------------
198199
class TRLayerSelectDLG(QtGui.QDialog):
@@ -923,7 +924,6 @@ def __init__(self, *args, **kwargs):
923924
''')
924925

925926
# - Layouts ----------------------------------------
926-
'''
927927
class TRFlowLayout(QtGui.QLayout):
928928
# As adapted from https://stackoverflow.com/questions/60398756/pyqt-oriented-flow-layout
929929

@@ -935,7 +935,6 @@ def __init__(self, orientation=QtCore.Qt.Horizontal, parent=None, margin=0, spac
935935
self.setContentsMargins(margin, margin, margin, margin)
936936

937937
self.setSpacing(spacing)
938-
939938
self.itemList = []
940939

941940
def __del__(self):
@@ -968,16 +967,16 @@ def hasHeightForWidth(self):
968967
return self.orientation == QtCore.Qt.Horizontal
969968

970969
def heightForWidth(self, width):
971-
return self.doLayout(QRect(0, 0, width, 0), True)
970+
return self.doLayout(QtCore.QRect(0, 0, width, 0), True)
972971

973972
def hasWidthForHeight(self):
974973
return self.orientation == QtCore.Qt.Vertical
975974

976975
def widthForHeight(self, height):
977-
return self.doLayout(QRect(0, 0, 0, height), True)
976+
return self.doLayout(QtCore.QRect(0, 0, 0, height), True)
978977

979978
def setGeometry(self, rect):
980-
super().setGeometry(rect)
979+
#super().setGeometry(rect)
981980
self.doLayout(rect, False)
982981

983982
def sizeHint(self):
@@ -989,9 +988,8 @@ def minimumSize(self):
989988
for item in self.itemList:
990989
size = size.expandedTo(item.minimumSize())
991990

992-
margin, _, _, _ = self.getContentsMargins()
991+
size += QtCore.QSize(2 * self.margin, 2 * self.margin)
993992

994-
size += QtCore.QSize(2 * margin, 2 * margin)
995993
return size
996994

997995
def doLayout(self, rect, testOnly):
@@ -1000,11 +998,13 @@ def doLayout(self, rect, testOnly):
1000998
lineHeight = columnWidth = heightForWidth = 0
1001999

10021000
for item in self.itemList:
1003-
wid = item.widget()
1004-
spaceX = self.spacing() + wid.style().layoutSpacing(QtGui.QSizePolicy.PushButton, QtGui.QSizePolicy.PushButton, QtCore.Qt.Horizontal)
1005-
spaceY = self.spacing() + wid.style().layoutSpacing(QtGui.QSizePolicy.PushButton, QtGui.QSizePolicy.PushButton, QtCore.Qt.Vertical)
1001+
widget = item.widget()
1002+
spaceX = self.spacing + widget.style().layoutSpacing(QtGui.QSizePolicy.PushButton, QtGui.QSizePolicy.PushButton, QtCore.Qt.Horizontal)
1003+
spaceY = self.spacing + widget.style().layoutSpacing(QtGui.QSizePolicy.PushButton, QtGui.QSizePolicy.PushButton, QtCore.Qt.Vertical)
1004+
10061005
if self.orientation == QtCore.Qt.Horizontal:
10071006
nextX = x + item.sizeHint().width() + spaceX
1007+
10081008
if nextX - spaceX > rect.right() and lineHeight > 0:
10091009
x = rect.x()
10101010
y = y + lineHeight + spaceY
@@ -1016,8 +1016,10 @@ def doLayout(self, rect, testOnly):
10161016

10171017
x = nextX
10181018
lineHeight = max(lineHeight, item.sizeHint().height())
1019+
10191020
else:
10201021
nextY = y + item.sizeHint().height() + spaceY
1022+
10211023
if nextY - spaceY > rect.bottom() and columnWidth > 0:
10221024
x = x + columnWidth + spaceX
10231025
y = rect.y()
@@ -1033,6 +1035,6 @@ def doLayout(self, rect, testOnly):
10331035

10341036
if self.orientation == QtCore.Qt.Horizontal:
10351037
return y + lineHeight - rect.y()
1038+
10361039
else:
10371040
return heightForWidth - rect.y()
1038-
'''

0 commit comments

Comments
 (0)