示例#1
0
class ViewWindow(QtGui.QWidget):
	def __init__(self, model, parent = None):
		QtGui.QWidget.__init__(self, parent)
		
		self.suppressupdates = True
		self.renderview = None
		self.model = model
		layout = QtGui.QHBoxLayout()
		
		self.setLayout(layout)
		layout.addWidget(ControlBar(model, self))
		vlayout = QtGui.QVBoxLayout()
		layout.addLayout(vlayout)
		
		# Two adaptors for two gui contexts
		self.rendermodel = RenderModelAdaptor(self.model)
		
		self.renderview = PrimaryRenderView( self.rendermodel, self)
		self.renderview.center = self.rendermodel.c
		self.renderview.scale = 0.45 / self.rendermodel.bbH

		self.renderview_zoomed = PrimaryRenderView( self.rendermodel, self, share=self.renderview)
		self.renderview_zoomed.disableMove = True
		self.renderview_zoomed.mode = "ZOOMED"
		
		self.infopanel = InfoPanel(model, self)
		self.splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
		self.hsplitter = QtGui.QSplitter(QtCore.Qt.Horizontal)
		self.hsplitter.addWidget(self.infopanel)
		self.hsplitter.addWidget(self.renderview_zoomed)
		self.splitter.addWidget(self.hsplitter)
		self.splitter.addWidget(self.renderview)
		self.splitter.setSizes ([self.splitter.height()/4, self.splitter.height()*3/4])
		
		vlayout.addWidget(self.splitter)
		self.poslabel = QtGui.QLabel()
		self.poslabel.setFixedHeight(16)
		vlayout.addWidget(self.poslabel)
		
		self.suppressupdates = False
		self.updateRender()
		
	def sizeHint(self):
			return QtCore.QSize(1000, 600)

	def updateRender(self):
		if not self.suppressupdates:
			self.renderview.updateGL()
			self.renderview_zoomed.center = -self.model.current_group.current_placement.x,-self.model.current_group.current_placement.y
			self.renderview_zoomed.scale = min(0.35 / self.rendermodel.getCurrentShapeBB(), 0.20)
			self.renderview_zoomed.updateGL()
		
			self.infopanel.update()
		
	def renderMouseMoved(self, coords):
		self.poslabel.setText("Cursor Position: %6.3f %6.3f" % coords)
示例#2
0
	def __init__(self, model, parent = None):
		QtGui.QWidget.__init__(self, parent)
		
		self.suppressupdates = True
		self.renderview = None
		self.model = model
		layout = QtGui.QHBoxLayout()
		
		self.setLayout(layout)
		layout.addWidget(ControlBar(model, self))
		vlayout = QtGui.QVBoxLayout()
		layout.addLayout(vlayout)
		
		# Two adaptors for two gui contexts
		self.rendermodel = RenderModelAdaptor(self.model)
		
		self.renderview = PrimaryRenderView( self.rendermodel, self)
		self.renderview.center = self.rendermodel.c
		self.renderview.scale = 0.45 / self.rendermodel.bbH

		self.renderview_zoomed = PrimaryRenderView( self.rendermodel, self, share=self.renderview)
		self.renderview_zoomed.disableMove = True
		self.renderview_zoomed.mode = "ZOOMED"
		
		self.infopanel = InfoPanel(model, self)
		self.splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
		self.hsplitter = QtGui.QSplitter(QtCore.Qt.Horizontal)
		self.hsplitter.addWidget(self.infopanel)
		self.hsplitter.addWidget(self.renderview_zoomed)
		self.splitter.addWidget(self.hsplitter)
		self.splitter.addWidget(self.renderview)
		self.splitter.setSizes ([self.splitter.height()/4, self.splitter.height()*3/4])
		
		vlayout.addWidget(self.splitter)
		self.poslabel = QtGui.QLabel()
		self.poslabel.setFixedHeight(16)
		vlayout.addWidget(self.poslabel)
		
		self.suppressupdates = False
		self.updateRender()