← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3862: Fix the inspector GUI for Qt5, thanks to Mark S. Bentley.

 

------------------------------------------------------------
revno: 3862
committer: Francois <francois.kneib@xxxxxxxxx>
timestamp: Thu 2016-05-19 14:15:14 +0200
message:
  Fix the inspector GUI for Qt5, thanks to Mark S. Bentley.
modified:
  gui/qt5/Inspector.py
  gui/qt5/SerializableEditor.py


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'gui/qt5/Inspector.py'
--- gui/qt5/Inspector.py	2015-06-26 20:19:22 +0000
+++ gui/qt5/Inspector.py	2016-05-19 12:15:14 +0000
@@ -10,14 +10,14 @@
 class EngineInspector(QWidget):
 	def __init__(self,parent=None):
 		QWidget.__init__(self,parent)
-		grid=QGridLayout(self); grid.setSpacing(0); grid.setMargin(0)
+		grid=QGridLayout(self); grid.setSpacing(0); grid.setContentsMargins(0,0,0,0)
 		self.serEd=SeqSerializable(parent=None,getter=lambda:O.engines,setter=lambda x:setattr(O,'engines',x),serType=Engine,path='O.engines')
 		grid.addWidget(self.serEd)
 		self.setLayout(grid)
 #class MaterialsInspector(QWidget):
 #	def __init__(self,parent=None):
 #		QWidget.__init__(self,parent)
-#		grid=QGridLayout(self); grid.setSpacing(0); grid.setMargin(0)
+#		grid=QGridLayout(self); grid.setSpacing(0); grid.setContentsMargins(0,0,0,0)
 #		self.serEd=SeqSerializable(parent=None,getter=lambda:O.materials,setter=lambda x:setattr(O,'materials',x),serType=Engine)
 #		grid.addWidget(self.serEd)
 #		self.setLayout(grid)
@@ -25,7 +25,7 @@
 class CellInspector(QWidget):
 	def __init__(self,parent=None):
 		QWidget.__init__(self,parent)
-		self.layout=QVBoxLayout(self) #; self.layout.setSpacing(0); self.layout.setMargin(0)
+		self.layout=QVBoxLayout(self) #; self.layout.setSpacing(0); self.layout.setContentsMargins(0,0,0,0)
 		self.periCheckBox=QCheckBox('periodic boundary',self)
 		self.periCheckBox.clicked.connect(self.update)
 		self.layout.addWidget(self.periCheckBox)
@@ -82,7 +82,7 @@
 		self.gotoBodyButton=QPushButton(u'→ #',self)
 		self.gotoIntrButton=QPushButton(u'→ #+#',self)
 		# id selector
-		topBoxWidget=QWidget(self); topBox=QHBoxLayout(topBoxWidget); topBox.setMargin(0); #topBox.setSpacing(0); 
+		topBoxWidget=QWidget(self); topBox=QHBoxLayout(topBoxWidget); topBox.setContentsMargins(0,0,0,0); #topBox.setSpacing(0); 
 		hashLabel=QLabel('#',self); hashLabel.setFixedWidth(8)
 		topBox.addWidget(hashLabel)
 		topBox.addWidget(self.bodyIdBox)
@@ -95,14 +95,14 @@
 		topBoxWidget.setLayout(topBox)
 		# forces display
 		forcesWidget=QFrame(self); forcesWidget.setFrameShape(QFrame.Box); self.forceGrid=QGridLayout(forcesWidget); 
-		self.forceGrid.setVerticalSpacing(0); self.forceGrid.setHorizontalSpacing(9); self.forceGrid.setMargin(4);
+		self.forceGrid.setVerticalSpacing(0); self.forceGrid.setHorizontalSpacing(9); self.forceGrid.setContentsMargins(4,4,4,4);
 		for i,j in itertools.product((0,1,2,3),(-1,0,1,2)):
 			lab=QLabel('<small>'+('force','torque','move','rot')[i]+'</small>' if j==-1 else ''); self.forceGrid.addWidget(lab,i,j+1);
 			if j>=0: lab.setAlignment(Qt.AlignRight)
 			if i>1: lab.hide() # do not show forced moves and rotations by default (they will appear if non-zero)
 		self.showMovRot=False
 		#
-		self.grid=QGridLayout(self); self.grid.setSpacing(0); self.grid.setMargin(0)
+		self.grid=QGridLayout(self); self.grid.setSpacing(0); self.grid.setContentsMargins(0,0,0,0)
 		self.grid.addWidget(topBoxWidget)
 		self.grid.addWidget(forcesWidget)
 		self.scroll=QScrollArea(self)
@@ -216,7 +216,7 @@
 		topBox.addWidget(self.gotoId2Button)
 		topBoxWidget.setLayout(topBox)
 		self.setWindowTitle(u'No interaction')
-		self.grid=QGridLayout(self); self.grid.setSpacing(0); self.grid.setMargin(0)
+		self.grid=QGridLayout(self); self.grid.setSpacing(0); self.grid.setContentsMargins(0,0,0,0)
 		self.grid.addWidget(topBoxWidget,0,0)
 		self.scroll=QScrollArea(self)
 		self.scroll.setWidgetResizable(True)
@@ -271,7 +271,7 @@
 
 		for i,name,widget in [(0,'Engines',self.engineInspector),(1,'Bodies',self.bodyInspector),(2,'Interactions',self.intrInspector),(3,'Cell',self.cellInspector)]:
 			self.tabWidget.addTab(widget,name)
-		grid=QGridLayout(self); grid.setSpacing(0); grid.setMargin(0)
+		grid=QGridLayout(self); grid.setSpacing(0); grid.setContentsMargins(0,0,0,0)
 		grid.addWidget(self.tabWidget)
 		self.setLayout(grid)
 	def changeIntrIds(self,ids):

=== modified file 'gui/qt5/SerializableEditor.py'
--- gui/qt5/SerializableEditor.py	2015-08-28 19:31:57 +0000
+++ gui/qt5/SerializableEditor.py	2016-05-19 12:15:14 +0000
@@ -136,7 +136,7 @@
 		self.setContentsMargins(0,0,0,0)
 		self.first=True
 		val=self.getter()
-		self.grid=QGridLayout(self); self.grid.setSpacing(0); self.grid.setMargin(0)
+		self.grid=QGridLayout(self); self.grid.setSpacing(0); self.grid.setContentsMargins(0,0,0,0)
 		for row,col in itertools.product(range(self.rows),range(self.cols)):
 			w=QLineEdit('')
 			self.grid.addWidget(w,row,col);
@@ -171,7 +171,7 @@
 	def __init__(self,parent,getter,setter):
 		AttrEditor.__init__(self,getter,setter)
 		QFrame.__init__(self,parent)
-		self.grid=QHBoxLayout(self); self.grid.setSpacing(0); self.grid.setMargin(0)
+		self.grid=QHBoxLayout(self); self.grid.setSpacing(0); self.grid.setContentsMargins(0,0,0,0)
 		for i in range(4):
 			if i==3:
 				# add vertical divider (axis | angle)
@@ -287,7 +287,7 @@
 		self.rows,self.cols=rows,cols
 		self.idxConverter=idxConverter
 		self.setContentsMargins(0,0,0,0)
-		self.grid=QGridLayout(self); self.grid.setSpacing(0); self.grid.setMargin(0)
+		self.grid=QGridLayout(self); self.grid.setSpacing(0); self.grid.setContentsMargins(0,0,0,0)
 		for row,col in itertools.product(range(self.rows),range(self.cols)):
 			w=QSpinBox()
 			w.setRange(int(-1e9),int(1e9)); w.setSingleStep(1);