当前位置: 首页>>代码示例>>Python>>正文


Python ValSlider.getValue方法代码示例

本文整理汇总了Python中valslider.ValSlider.getValue方法的典型用法代码示例。如果您正苦于以下问题:Python ValSlider.getValue方法的具体用法?Python ValSlider.getValue怎么用?Python ValSlider.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在valslider.ValSlider的用法示例。


在下文中一共展示了ValSlider.getValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from valslider import ValSlider [as 别名]
# 或者: from valslider.ValSlider import getValue [as 别名]
class EMTransformPanel:
	def __init__(self,target,parent):
		self.target = weakref.ref(target)
		self.parent = weakref.ref(parent)
		
		self.label_src = QtGui.QLabel(parent)
		self.label_src.setText('Rotation Convention')
		
		self.src = QtGui.QComboBox(parent)
		self.load_src_options(self.src)
		
		self.x_label = QtGui.QLabel()
		self.x_label.setText('x')
		
		self.x_trans = QtGui.QDoubleSpinBox(parent)
		self.x_trans.setMinimum(-10000)
		self.x_trans.setMaximum(10000)
		self.x_trans.setValue(0.0)
	
		self.y_label = QtGui.QLabel()
		self.y_label.setText('y')
		
		self.y_trans = QtGui.QDoubleSpinBox(parent)
		self.y_trans.setMinimum(-10000)
		self.y_trans.setMaximum(10000)
		self.y_trans.setValue(0.0)
		
		self.z_label = QtGui.QLabel()
		self.z_label.setText('z')
		
		self.z_trans = QtGui.QDoubleSpinBox(parent)
		self.z_trans.setMinimum(-10000)
		self.z_trans.setMaximum(10000)
		self.z_trans.setValue(0.0)
		
		self.az = ValSlider(parent,(-360.0,360.0),"az",-1)
		self.az.setObjectName("az")
		self.az.setValue(0.0)
		
		self.alt = ValSlider(parent,(-180.0,180.0),"alt",-1)
		self.alt.setObjectName("alt")
		self.alt.setValue(0.0)
		
		self.phi = ValSlider(parent,(-360.0,360.0),"phi",-1)
		self.phi.setObjectName("phi")
		self.phi.setValue(0.0)
		
		self.scale = ValSlider(parent,(0.01,30.0),"Zoom:")
		self.scale.setObjectName("scale")
		self.scale.setValue(1.0)
		
		self.n3_showing = False
		
		self.current_src = "eman"
		
		QtCore.QObject.connect(self.az, QtCore.SIGNAL("valueChanged"), self.slider_rotate)
		QtCore.QObject.connect(self.alt, QtCore.SIGNAL("valueChanged"), self.slider_rotate)
		QtCore.QObject.connect(self.phi, QtCore.SIGNAL("valueChanged"), self.slider_rotate)
		QtCore.QObject.connect(self.src, QtCore.SIGNAL("currentIndexChanged(QString)"), self.set_src)
		QtCore.QObject.connect(self.scale, QtCore.SIGNAL("valueChanged"), self.target().set_scale)
		QtCore.QObject.connect(self.x_trans, QtCore.SIGNAL("valueChanged(double)"), self.target().set_cam_x)
		QtCore.QObject.connect(self.y_trans, QtCore.SIGNAL("valueChanged(double)"), self.target().set_cam_y)
		QtCore.QObject.connect(self.z_trans, QtCore.SIGNAL("valueChanged(double)"), self.target().set_cam_z)
		
		
	def set_defaults(self):
		self.x_trans.setValue(0.0)
		self.y_trans.setValue(0.0)
		self.z_trans.setValue(0.0)
		self.scale.setValue(1.0)
		self.az.setValue(0.0)
		self.alt.setValue(0.0)
		self.phi.setValue(0.0)
		
	def slider_rotate(self):
		self.target().load_rotation(self.get_current_rotation())
		
	def get_current_rotation(self):
		convention = self.src.currentText()
		rot = {}
		if ( self.current_src == "spin" ):
			rot[self.az.getLabel()] = self.az.getValue()
			
			n1 = self.alt.getValue()
			n2 = self.phi.getValue()
			n3 = self.n3.getValue()
			
			norm = sqrt(n1*n1 + n2*n2 + n3*n3)
			
			n1 /= norm
			n2 /= norm
			n3 /= norm
			
			rot[self.alt.getLabel()] = n1
			rot[self.phi.getLabel()] = n2
			rot[self.n3.getLabel()] = n3
			
		else:
			rot[self.az.getLabel()] = self.az.getValue()
			rot[self.alt.getLabel()] = self.alt.getValue()
#.........这里部分代码省略.........
开发者ID:CVL-dev,项目名称:StructuralBiology,代码行数:103,代码来源:emimageutil.py

示例2: TrackerControl

# 需要导入模块: from valslider import ValSlider [as 别名]
# 或者: from valslider.ValSlider import getValue [as 别名]

#.........这里部分代码省略.........
		self.map3d=self.reconstruct(stack,self.tiltstep,mode)
		self.update_3d()

		
	def do_magict(self,x):
		"""In response to tomographic filling reconstruction button. Just a wrapper"""
		stack=self.get_boxed_stack()
#		self.map3d=self.reconstruct_ca(stack[5:-4],0.5)
#		init=self.reconstruct_ca(stack[5:-4],0.5)
		mode=self.sbmode.value()
		self.map3d=self.reconstruct_wedgefill(stack,self.tiltstep,mode)
		self.update_3d()
		
	def do_magics(self,x):
		"""In response to the 3D Sph button. Just a wrapper"""
		return
		
	def do_magicc(self,x):
		"""In response to the 3D cyl button. Just a wrapper"""
		return
		
	def do_filter(self,v):
		"""In response to the filter ValSlider"""
		if self.map3d==None : return
		self.lpfilt=v
		self.update_3d()
		
	def do_savedata(self):
		""
	
	def update_3d(self):
		if self.map3d==None : return
		
		self.filt3d=self.map3d.process("filter.lowpass.gauss",{"cutoff_abs":self.vslpfilt.getValue()})
		
		self.imvol.set_data(self.filt3d)
		self.imvol.show()
		self.imvol.updateGL()

		sz=self.map3d["nx"]
		xsum=self.filt3d.process("misc.directional_sum",{"axis":"x"})
		xsum.set_size(sz,sz,1)
		ysum=self.filt3d.process("misc.directional_sum",{"axis":"y"})
		ysum.set_size(sz,sz,1)
		zsum=self.filt3d.process("misc.directional_sum",{"axis":"z"})
		zsum.set_size(sz,sz,1)
		
		self.improj.set_data([zsum,ysum,xsum])
		self.improj.show()
		self.improj.updateGL()

		self.imslice.set_data(self.filt3d)
		self.imslice.show()
		self.imslice.updateGL()
	
	def update_stack(self):
		stack=self.get_boxed_stack()
		self.imboxed.set_data(stack)
		self.imboxed.show()
		self.imboxed.updateGL()
		

	def set_image(self,fsp):
		"""Takes an ali file to process"""
		self.imageparm=EMData(fsp,0,True).get_attr_dict()
		print "%d slices at %d x %d"%(self.imageparm["nz"],self.imageparm["nx"],self.imageparm["ny"])
开发者ID:cpsemmens,项目名称:eman2,代码行数:70,代码来源:tomotrackbox.py

示例3: EMItem3DInspector

# 需要导入模块: from valslider import ValSlider [as 别名]
# 或者: from valslider.ValSlider import getValue [as 别名]

#.........这里部分代码省略.........
		xformbox.addWidget(tzlabel, 5, 0, 1, 1)
		zoomlabel = QtGui.QLabel("Zoom",xformframe)
		zoomlabel.setAlignment(QtCore.Qt.AlignCenter)
		xformbox.addWidget(zoomlabel, 5, 1, 1, 1)
		self.tz = EMSpinWidget(0.0, 1.0)
		self.zoom = EMSpinWidget(1.0, 0.1, postivemode=True, wheelstep=0.1)
		xformbox.addWidget(self.tz, 6, 0, 1, 1)
		xformbox.addWidget(self.zoom, 6, 1, 1, 1)
		self.resetbuttontx = QtGui.QPushButton("Reset Tx")
		self.resetbuttonrot = QtGui.QPushButton("Reset Rot")
		xformbox.addWidget(self.resetbuttontx, 7, 0, 1, 1)
		xformbox.addWidget(self.resetbuttonrot, 7, 1, 1, 1)
		xformframe.setLayout(xformbox)
		xformframe.setMaximumWidth(350)
				
		xformframe.setMaximumHeight(self.transfromboxmaxheight)
		xformframe.setLayout(xformbox)
		gridbox.addWidget(xformframe, 2, 0, 1, 1)
		
		# set to default, but run only as a base class
		if type(self) == EMItem3DInspector: self.updateItemControls()
		
		QtCore.QObject.connect(self.tx,QtCore.SIGNAL("valueChanged(int)"),self._on_translation)
		QtCore.QObject.connect(self.ty,QtCore.SIGNAL("valueChanged(int)"),self._on_translation)
		QtCore.QObject.connect(self.tz,QtCore.SIGNAL("valueChanged(int)"),self._on_translation)
		QtCore.QObject.connect(self.zoom,QtCore.SIGNAL("valueChanged(int)"),self._on_scale)
		QtCore.QObject.connect(self.resetbuttontx,QtCore.SIGNAL("clicked()"),self._on_resettx)
		QtCore.QObject.connect(self.resetbuttonrot,QtCore.SIGNAL("clicked()"),self._on_resetrot)
	
	def _on_translation(self, value):
		"""
		Need to contain the right coords. And do translation in the correct corrd system
		"""
		tt = t = Transform({"tx":self.tx.getValue(),"ty":self.ty.getValue(),"tz":self.tz.getValue()})
		tp = self.item3d().getParentMatrixProduct()
		if tp: tt = tp.inverse()*t
		self.item3d().getTransform().set_trans(tt.get_trans())
		self.inspector().updateSceneGraph()
		
	def _on_scale(self, value):
		self.item3d().getTransform().set_scale(self.zoom.getValue())
		self.inspector().updateSceneGraph()

	def _on_resettx(self):
		
		self.item3d().getTransform().set_trans(0.0, 0.0, 0.0)
		self.updateItemControls()
		self.inspector().updateSceneGraph()
		
	def _on_resetrot(self):
		self.item3d().getTransform().set_rotation({"type":"eman","az":0.0,"alt":0.0,"phi":0.0})
		self.updateItemControls()
		self.inspector().updateSceneGraph()
	
	def _isRotNaN(self, rot1, rot2, rot3):
		""" Better check to make sure get_rotation did not return Nan, so to prevent a crash """
		if rot1 != rot1: return True
		if rot2 != rot2: return True
		if rot3 != rot3: return True
		return False
		
	def updateItemControls(self):
		""" Updates this item inspector. Function is called by the item it observes"""
		# Translation update
		stdtransfrom = self.item3d().getTransformStdCoord()
		translation =  stdtransfrom.get_trans()
开发者ID:cpsemmens,项目名称:eman2,代码行数:70,代码来源:emitem3d.py

示例4: EMGLPlotInspector

# 需要导入模块: from valslider import ValSlider [as 别名]
# 或者: from valslider.ValSlider import getValue [as 别名]

#.........这里部分代码省略.........
			maintab.vbl.addWidget(self.phi)
		
			self.current_src = EULER_EMAN
		
		return self.maintab

	def set_xy_trans(self, x, y):
		self.x_trans.setValue(x)
		self.y_trans.setValue(y)
	
	def set_translate_scale(self, xscale,yscale,zscale):
		self.x_trans.setSingleStep(xscale)
		self.y_trans.setSingleStep(yscale)
		self.z_trans.setSingleStep(zscale)

	def update_rotations(self,t3d):
		rot = t3d.get_rotation(self.src_map[str(self.src.itemText(self.src.currentIndex()))])
		
		convention = self.src.currentText()
		if ( self.src_map[str(convention)] == EULER_SPIN ):
			self.n3.setValue(rot[self.n3.getLabel()],True)
		
		self.az.setValue(rot[self.az.getLabel()],True)
		self.alt.setValue(rot[self.alt.getLabel()],True)
		self.phi.setValue(rot[self.phi.getLabel()],True)
	
	def slider_rotate(self):
		self.target.load_rotation(self.get_current_rotation())
	
	def get_current_rotation(self):
		convention = self.src.currentText()
		rot = {}
		if ( self.current_src == EULER_SPIN ):
			rot[self.az.getLabel()] = self.az.getValue()
			
			n1 = self.alt.getValue()
			n2 = self.phi.getValue()
			n3 = self.n3.getValue()
			
			norm = sqrt(n1*n1 + n2*n2 + n3*n3)
			
			n1 /= norm
			n2 /= norm
			n3 /= norm
			
			rot[self.alt.getLabel()] = n1
			rot[self.phi.getLabel()] = n2
			rot[self.n3.getLabel()] = n3
			
		else:
			rot[self.az.getLabel()] = self.az.getValue()
			rot[self.alt.getLabel()] = self.alt.getValue()
			rot[self.phi.getLabel()] = self.phi.getValue()
		
		return Transform3D(self.current_src, rot)
	
	def set_src(self, val):
		t3d = self.get_current_rotation()
		
		if (self.n3_showing) :
			self.vbl.removeWidget(self.n3)
			self.n3.deleteLater()
			self.n3_showing = False
			self.az.setRange(-360,360)
			self.alt.setRange(-180,180)
			self.phi.setRange(-360,660)
开发者ID:CVL-dev,项目名称:StructuralBiology,代码行数:70,代码来源:emglplot.py

示例5: GUIctfsim

# 需要导入模块: from valslider import ValSlider [as 别名]
# 或者: from valslider.ValSlider import getValue [as 别名]

#.........这里部分代码省略.........

		QtCore.QObject.connect(self.sdefocus, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.sbfactor, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.sdfdiff, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.sdfang, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.sapix, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.sampcont, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.svoltage, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.scs, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.ssamples, QtCore.SIGNAL("valueChanged"), self.newCTF)
		QtCore.QObject.connect(self.setlist,QtCore.SIGNAL("currentRowChanged(int)"),self.newSet)
		QtCore.QObject.connect(self.setlist,QtCore.SIGNAL("keypress"),self.listkey)
		QtCore.QObject.connect(self.splotmode,QtCore.SIGNAL("currentIndexChanged(int)"),self.newPlotMode)

	   	QtCore.QObject.connect(self.newbut,QtCore.SIGNAL("clicked(bool)"),self.on_new_but)


		self.resize(720,380) # figured these values out by printing the width and height in resize event


		E2loadappwin("e2ctfsim","main",self)
		E2loadappwin("e2ctfsim","image",self.guiim.qt_parent)
#		E2loadappwin("e2ctf","realimage",self.guirealim.qt_parent)
		E2loadappwin("e2ctfsim","plot",self.guiplot.qt_parent)

		self.setWindowTitle("CTF")

	def listkey(self,event):

		if event.key()>=Qt.Key_0 and event.key()<=Qt.Key_9 :
			q=int(event.key())-Qt.Key_0
			self.squality.setValue(q)
		elif event.key() == Qt.Key_Left:
			self.sdefocus.setValue(self.sdefocus.getValue()-0.01)
		elif event.key() == Qt.Key_Right:
			self.sdefocus.setValue(self.sdefocus.getValue()+0.01)
		elif event.key()==Qt.Key_R :
			self.on_recall_params()


	def on_new_but(self):
		ctf=EMAN2Ctf()
		ctf.defocus=1.0
		ctf.voltage=self.df_voltage
		ctf.apix=self.df_apix
		ctf.cs=self.df_cs
		ctf.ac=self.df_ac
		ctf.samples=self.df_samples
		self.data.append((str(len(self.setlist)+1),ctf))
		self.curset=len(self.data)
		self.update_data()
		
	def show_guis(self):
		if self.guiim != None:
			self.app().show_specific(self.guiim)
		if self.guiplot != None:
			self.app().show_specific(self.guiplot)
		#if self.guirealim != None:
			#self.app().show_specific(self.guirealim)

		self.show()

	def closeEvent(self,event):
#		QtGui.QWidget.closeEvent(self,event)
#		self.app.app.closeAllWindows()
		E2saveappwin("e2ctf","main",self)
开发者ID:liming2016,项目名称:eman2,代码行数:70,代码来源:e2ctfsim.py

示例6: EMInspectorControlLine

# 需要导入模块: from valslider import ValSlider [as 别名]
# 或者: from valslider.ValSlider import getValue [as 别名]

#.........这里部分代码省略.........
		sidelabel2.setAlignment(QtCore.Qt.AlignVCenter)
		linegridbox.addWidget(sidelabel2, 3, 0, 1, 1)
		
		self.leftShowArrow = QtGui.QCheckBox("Show")
		self.leftShowArrow.setChecked(self.item3d().showLeftArrow)
		linegridbox.addWidget(self.leftShowArrow, 1, 1, 1, 1)
		
		self.leftArrowSize = EMSpinWidget(int(self.item3d().leftArrowSize), 1.0, rounding=0)
		self.leftArrowSize.setMinimumWidth(120)
		linegridbox.addWidget(self.leftArrowSize, 2, 1, 1, 1)
		
		self.leftArrowLength = EMSpinWidget(int(self.item3d().leftArrowLength), 1.0, rounding=0)
		self.leftArrowLength.setMinimumWidth(120)
		linegridbox.addWidget(self.leftArrowLength, 3, 1, 1, 1)
		
		rightlabel = QtGui.QLabel("Right arrow")
		rightlabel.setFont(lfont)
		rightlabel.setAlignment(QtCore.Qt.AlignCenter)
		linegridbox.addWidget(rightlabel, 0, 2, 1, 1)
		
		self.rightShowArrow = QtGui.QCheckBox("Show")
		self.rightShowArrow.setChecked(self.item3d().showRightArrow)
		linegridbox.addWidget(self.rightShowArrow, 1, 2, 1, 1)
		
		self.rightArrowSize = EMSpinWidget(int(self.item3d().rightArrowSize), 1.0, rounding=0)
		self.rightArrowSize.setMinimumWidth(120)
		linegridbox.addWidget(self.rightArrowSize, 2, 2, 1, 1)
		
		self.rightArrowLength = EMSpinWidget(int(self.item3d().rightArrowLength), 1.0, rounding=0)
		self.rightArrowLength.setMinimumWidth(120)
		linegridbox.addWidget(self.rightArrowLength, 3, 2, 1, 1)
		
		linelengthlabel = QtGui.QLabel("Line Length")
		linelengthlabel.setFont(lfont)
		linelengthlabel.setAlignment(QtCore.Qt.AlignCenter)
		linegridbox.addWidget(linelengthlabel, 4, 0, 2, 2)
		
		self.linelength = EMSpinWidget(int(self.item3d().length), 1.0, rounding=0)
		linegridbox.addWidget(self.linelength, 4, 2, 2, 2)
		
		linewidthlabel = QtGui.QLabel("Line Width")
		linewidthlabel.setFont(lfont)
		linewidthlabel.setAlignment(QtCore.Qt.AlignCenter)
		linegridbox.addWidget(linewidthlabel, 5, 0, 1, 2)
		
		self.linewidth = EMSpinWidget(int(self.item3d().width), 1.0, rounding=0)
		linegridbox.addWidget(self.linewidth, 5, 2, 1, 2)
		
		lineframe.setLayout(linegridbox)	
		gridbox.addWidget(lineframe, 2, 0)
		
		#frame to control slice/stack of the line
		lineframe2 = QtGui.QFrame()
		lineframe2.setFrameShape(QtGui.QFrame.StyledPanel)
		linehbox = QtGui.QVBoxLayout()
				
		self.slice = ValSlider(lineframe2, (1, 100), "Slice", rounding=0)
		self.slice.setValue(self.item3d().slices)
		
		self.stack = ValSlider(lineframe2, (1, 100), "Stack", rounding=0)
		self.slice.setValue(self.item3d().stacks)
		
		linehbox.addWidget(self.slice)
		linehbox.addWidget(self.stack)
		
		lineframe2.setLayout(linehbox)
		gridbox.addWidget(lineframe2, 3, 0)
		
		# set to default, but run only as a base class
		if type(self) == EMInspectorControl3DText: 
			self.updateItemControls()
			self.updateMetaData()
		
		QtCore.QObject.connect(self.leftShowArrow, QtCore.SIGNAL("stateChanged(int)"), self.redraw)
		QtCore.QObject.connect(self.rightShowArrow, QtCore.SIGNAL("stateChanged(int)"), self.redraw)
		QtCore.QObject.connect(self.leftArrowSize,QtCore.SIGNAL("valueChanged(int)"),self.redraw)
		QtCore.QObject.connect(self.leftArrowLength,QtCore.SIGNAL("valueChanged(int)"),self.redraw)
		QtCore.QObject.connect(self.rightArrowSize,QtCore.SIGNAL("valueChanged(int)"),self.redraw)
		QtCore.QObject.connect(self.rightArrowLength,QtCore.SIGNAL("valueChanged(int)"),self.redraw)
		QtCore.QObject.connect(self.linelength,QtCore.SIGNAL("valueChanged(int)"),self.redraw)
		QtCore.QObject.connect(self.linewidth,QtCore.SIGNAL("valueChanged(int)"),self.redraw)
		
		QtCore.QObject.connect(self.slice,QtCore.SIGNAL("valueChanged"),self.redraw)
		QtCore.QObject.connect(self.stack,QtCore.SIGNAL("valueChanged"),self.redraw)

	def redraw(self):
		self.item3d().setShowLeftArrow(self.leftShowArrow.isChecked())
		self.item3d().setShowRightArrow(self.rightShowArrow.isChecked())
		self.item3d().leftArrowSize = self.leftArrowSize.getValue()
		self.item3d().leftArrowLength = self.leftArrowLength.getValue()
		self.item3d().rightArrowSize = self.rightArrowSize.getValue()
		self.item3d().rightArrowLength = self.rightArrowLength.getValue()
		self.item3d().setLength(self.linelength.getValue())
		self.item3d().setWidth(self.linewidth.getValue())
		
		self.item3d().setSlices(self.slice.getValue())
		self.item3d().setStacks(self.stack.getValue())
		
		if self.inspector:
			self.inspector().updateSceneGraph()
开发者ID:CVL-dev,项目名称:StructuralBiology,代码行数:104,代码来源:emshapeitem3d.py


注:本文中的valslider.ValSlider.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。