26
26
from typerig .proxy .fl .objects .glyph import eGlyph
27
27
28
28
# - Init ----------------------------------
29
- __version__ = '0.3.7 '
29
+ __version__ = '0.3.9 '
30
30
31
31
# - Keep compatibility for basestring checks
32
32
try :
@@ -193,6 +193,7 @@ def __init__(self, button_text, init_values=(0., 100., 0., 1.), tooltip=(None, N
193
193
self .box .addWidget (self .input )
194
194
self .box .addWidget (self .button )
195
195
self .setLayout (self .box )
196
+ self .setSizePolicy (QtGui .QSizePolicy .Fixed , QtGui .QSizePolicy .Fixed )
196
197
197
198
# -- Sub Dialogs --------------------------
198
199
class TRLayerSelectDLG (QtGui .QDialog ):
@@ -923,7 +924,6 @@ def __init__(self, *args, **kwargs):
923
924
''' )
924
925
925
926
# - Layouts ----------------------------------------
926
- '''
927
927
class TRFlowLayout (QtGui .QLayout ):
928
928
# As adapted from https://stackoverflow.com/questions/60398756/pyqt-oriented-flow-layout
929
929
@@ -935,7 +935,6 @@ def __init__(self, orientation=QtCore.Qt.Horizontal, parent=None, margin=0, spac
935
935
self .setContentsMargins (margin , margin , margin , margin )
936
936
937
937
self .setSpacing (spacing )
938
-
939
938
self .itemList = []
940
939
941
940
def __del__ (self ):
@@ -968,16 +967,16 @@ def hasHeightForWidth(self):
968
967
return self .orientation == QtCore .Qt .Horizontal
969
968
970
969
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 )
972
971
973
972
def hasWidthForHeight (self ):
974
973
return self .orientation == QtCore .Qt .Vertical
975
974
976
975
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 )
978
977
979
978
def setGeometry (self , rect ):
980
- super().setGeometry(rect)
979
+ # super().setGeometry(rect)
981
980
self .doLayout (rect , False )
982
981
983
982
def sizeHint (self ):
@@ -989,9 +988,8 @@ def minimumSize(self):
989
988
for item in self .itemList :
990
989
size = size .expandedTo (item .minimumSize ())
991
990
992
- margin, _, _, _ = self.getContentsMargins( )
991
+ size += QtCore . QSize ( 2 * self . margin , 2 * self .margin )
993
992
994
- size += QtCore.QSize(2 * margin, 2 * margin)
995
993
return size
996
994
997
995
def doLayout (self , rect , testOnly ):
@@ -1000,11 +998,13 @@ def doLayout(self, rect, testOnly):
1000
998
lineHeight = columnWidth = heightForWidth = 0
1001
999
1002
1000
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
+
1006
1005
if self .orientation == QtCore .Qt .Horizontal :
1007
1006
nextX = x + item .sizeHint ().width () + spaceX
1007
+
1008
1008
if nextX - spaceX > rect .right () and lineHeight > 0 :
1009
1009
x = rect .x ()
1010
1010
y = y + lineHeight + spaceY
@@ -1016,8 +1016,10 @@ def doLayout(self, rect, testOnly):
1016
1016
1017
1017
x = nextX
1018
1018
lineHeight = max (lineHeight , item .sizeHint ().height ())
1019
+
1019
1020
else :
1020
1021
nextY = y + item .sizeHint ().height () + spaceY
1022
+
1021
1023
if nextY - spaceY > rect .bottom () and columnWidth > 0 :
1022
1024
x = x + columnWidth + spaceX
1023
1025
y = rect .y ()
@@ -1033,6 +1035,6 @@ def doLayout(self, rect, testOnly):
1033
1035
1034
1036
if self .orientation == QtCore .Qt .Horizontal :
1035
1037
return y + lineHeight - rect .y ()
1038
+
1036
1039
else :
1037
1040
return heightForWidth - rect .y ()
1038
- '''
0 commit comments