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


Python profile.putProfileSetting函数代码示例

本文整理汇总了Python中util.profile.putProfileSetting函数的典型用法代码示例。如果您正苦于以下问题:Python putProfileSetting函数的具体用法?Python putProfileSetting怎么用?Python putProfileSetting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: OnSettingChange

	def OnSettingChange(self, e):
		if self.type == 'profile':
			profile.putProfileSetting(self.configName, self.GetValue())
		else:
			profile.putPreference(self.configName, self.GetValue())
		result = validators.SUCCESS
		msgs = []
		for validator in self.validators:
			res, err = validator.validate()
			if res == validators.ERROR:
				result = res
			elif res == validators.WARNING and result != validators.ERROR:
				result = res
			if res != validators.SUCCESS:
				msgs.append(err)
		if result == validators.ERROR:
			self.ctrl.SetBackgroundColour('Red')
		elif result == validators.WARNING:
			self.ctrl.SetBackgroundColour('Yellow')
		else:
			self.ctrl.SetBackgroundColour(self.defaultBGColour)
		self.ctrl.Refresh()

		self.validationMsg = '\n'.join(msgs)
		self.panel.main.UpdatePopup(self)
开发者ID:CNCBASHER,项目名称:Cura,代码行数:25,代码来源:configBase.py

示例2: OnMouseMotion

	def OnMouseMotion(self,e):
		if self.parent.objectsMaxV != None:
			size = (self.parent.objectsMaxV - self.parent.objectsMinV)
			sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))
			
			p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport))
			p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport))
			cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2]))
			cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1]))
			if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:
				self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))
			else:
				self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))

		if e.Dragging() and e.LeftIsDown():
			if self.dragType == '':
				#Define the drag type depending on the cursor position.
				if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:
					self.dragType = 'modelRotate'
					self.dragStart = math.atan2(cursorZ0[0], cursorZ0[1])
				else:
					self.dragType = 'viewRotate'
				
			if self.dragType == 'viewRotate':
				if self.view3D:
					self.yaw += e.GetX() - self.oldX
					self.pitch -= e.GetY() - self.oldY
					if self.pitch > 170:
						self.pitch = 170
					if self.pitch < 10:
						self.pitch = 10
				else:
					self.offsetX += float(e.GetX() - self.oldX) * self.zoom / self.GetSize().GetHeight() * 2
					self.offsetY -= float(e.GetY() - self.oldY) * self.zoom / self.GetSize().GetHeight() * 2
			elif self.dragType == 'modelRotate':
				angle = math.atan2(cursorZ0[0], cursorZ0[1])
				diff = self.dragStart - angle
				self.tempRotate = diff * 180 / math.pi
			#Workaround for buggy ATI cards.
			size = self.GetSizeTuple()
			self.SetSize((size[0]+1, size[1]))
			self.SetSize((size[0], size[1]))
			self.Refresh()
		else:
			if self.tempRotate != 0:
				profile.putProfileSetting('model_rotate_base', profile.getProfileSettingFloat('model_rotate_base') + self.tempRotate)
				self.parent.updateModelTransform()
				self.tempRotate = 0
				
			self.dragType = ''
		if e.Dragging() and e.RightIsDown():
			self.zoom += e.GetY() - self.oldY
			if self.zoom < 1:
				self.zoom = 1
			self.Refresh()
		self.oldX = e.GetX()
		self.oldY = e.GetY()
开发者ID:CNCBASHER,项目名称:Cura,代码行数:57,代码来源:preview3d.py

示例3: OnButtonProfile

	def OnButtonProfile(self, event):
		if buttons.GenBitmapToggleButton.GetValue(self):
			self.SetBitmap(True)
			profile.putProfileSetting(self.profileSetting, 'True')
		else:
			self.SetBitmap(False)
			profile.putProfileSetting(self.profileSetting, 'False')
		self.callback()
		event.Skip()
开发者ID:custodian,项目名称:Cura,代码行数:9,代码来源:toolbarUtil.py

示例4: OnScaleMax

	def OnScaleMax(self, e):
		if self.objectsMinV == None:
			return
		vMin = self.objectsMinV
		vMax = self.objectsMaxV
		scaleX1 = (self.machineSize.x - self.machineCenter.x) / ((vMax[0] - vMin[0]) / 2)
		scaleY1 = (self.machineSize.y - self.machineCenter.y) / ((vMax[1] - vMin[1]) / 2)
		scaleX2 = (self.machineCenter.x) / ((vMax[0] - vMin[0]) / 2)
		scaleY2 = (self.machineCenter.y) / ((vMax[1] - vMin[1]) / 2)
		scaleZ = self.machineSize.z / (vMax[2] - vMin[2])
		scale = min(scaleX1, scaleY1, scaleX2, scaleY2, scaleZ)
		self.scale.SetValue(str(scale))
		profile.putProfileSetting('model_scale', self.scale.GetValue())
		self.glCanvas.Refresh()
开发者ID:bwattendorf,项目名称:Cura,代码行数:14,代码来源:preview3d.py

示例5: StoreData

	def StoreData(self):
		profile.putPreference('machine_width', self.machineWidth.GetValue())
		profile.putPreference('machine_depth', self.machineDepth.GetValue())
		profile.putPreference('machine_height', self.machineHeight.GetValue())
		profile.putProfileSetting('nozzle_size', self.nozzleSize.GetValue())
		profile.putProfileSetting('machine_center_x', profile.getPreferenceFloat('machine_width') / 2)
		profile.putProfileSetting('machine_center_y', profile.getPreferenceFloat('machine_depth') / 2)
		profile.putProfileSetting('wall_thickness', float(profile.getProfileSettingFloat('nozzle_size')) * 2)
		profile.putPreference('has_heated_bed', str(self.heatedBed.GetValue()))
开发者ID:PKartaviy,项目名称:Cura,代码行数:9,代码来源:configWizard.py

示例6: OnResetProfile

	def OnResetProfile(self, e):
		dlg = wx.MessageDialog(self, 'This will reset all profile settings to defaults.\nUnless you have saved your current profile, all settings will be lost!\nDo you really want to reset?', 'Profile reset', wx.YES_NO | wx.ICON_QUESTION)
		result = dlg.ShowModal() == wx.ID_YES
		dlg.Destroy()
		if result:
			profile.resetGlobalProfile()
			if profile.getPreference('machine_type') == 'reprap':
				profile.putProfileSetting('nozzle_size', '0.5')
				profile.putProfileSetting('machine_center_x', '40')
				profile.putProfileSetting('machine_center_y', '40')
			self.updateProfileToControls()
开发者ID:festlv,项目名称:Cura,代码行数:11,代码来源:mainWindow.py

示例7: OnResetProfile

 def OnResetProfile(self, e):
     dlg = wx.MessageDialog(
         self,
         "This will reset all profile settings to defaults.\nUnless you have saved your current profile, all settings will be lost!\nDo you really want to reset?",
         "Profile reset",
         wx.YES_NO | wx.ICON_QUESTION,
     )
     result = dlg.ShowModal() == wx.ID_YES
     dlg.Destroy()
     if result:
         profile.resetGlobalProfile()
         if profile.getPreference("machine_type") == "reprap":
             profile.putProfileSetting("nozzle_size", "0.5")
             profile.putProfileSetting("machine_center_x", "40")
             profile.putProfileSetting("machine_center_y", "40")
         self.updateProfileToControls()
开发者ID:younew,项目名称:Cura,代码行数:16,代码来源:mainWindow.py

示例8: OnResetAll

	def OnResetAll(self, e = None):
		profile.putProfileSetting('model_scale', '1.0')
		profile.putProfileSetting('model_rotate_base', '0')
		profile.putProfileSetting('flip_x', 'False')
		profile.putProfileSetting('flip_y', 'False')
		profile.putProfileSetting('flip_z', 'False')
		profile.putProfileSetting('swap_xz', 'False')
		profile.putProfileSetting('swap_yz', 'False')
		self.updateProfileToControls()
开发者ID:Ademan,项目名称:Cura,代码行数:9,代码来源:preview3d.py

示例9: OnResetAll

	def OnResetAll(self, e):
		profile.putProfileSetting('model_scale', '1.0')
		profile.putProfileSetting('model_rotate_base', '0')
		profile.putProfileSetting('flip_x', 'False')
		profile.putProfileSetting('flip_y', 'False')
		profile.putProfileSetting('flip_z', 'False')
		profile.putProfileSetting('swap_xz', 'False')
		profile.putProfileSetting('swap_yz', 'False')
		self.updateProfileToControls()
		self.warningPopup.Show(False)
		self.warningPopup.timer.Stop()
开发者ID:bwattendorf,项目名称:Cura,代码行数:11,代码来源:preview3d.py

示例10: updateModelTransform

	def updateModelTransform(self, f=0):
		if len(self.objectList) < 1 or self.objectList[0].mesh == None:
			return
		
		rotate = 0
		mirrorX = self.mirrorx
		mirrorY = self.mirrory
		mirrorZ = self.mirrorz
		swapXZ = self.flipxy
		swapYZ = self.flipyz

		profile.putProfileSetting('model_scale', self.scale)
		profile.putProfileSetting('model_rotate_base', '0')
		profile.putProfileSetting('flip_x', mirrorX)
		profile.putProfileSetting('flip_y', mirrorY)
		profile.putProfileSetting('flip_z', mirrorZ)
		profile.putProfileSetting('swap_xz', swapXZ)
		profile.putProfileSetting('swap_yz', swapYZ)

		for obj in self.objectList:
			if obj.mesh == None:
				continue
			obj.mesh.setRotateMirror(rotate, mirrorX, mirrorY, mirrorZ, swapXZ, swapYZ)
		
		minV = self.objectList[0].mesh.getMinimum()
		maxV = self.objectList[0].mesh.getMaximum()
		for obj in self.objectList:
			if obj.mesh == None:
				continue

			obj.mesh.getMinimumZ()
			minV = numpy.minimum(minV, obj.mesh.getMinimum())
			maxV = numpy.maximum(maxV, obj.mesh.getMaximum())

		self.objectsMaxV = maxV
		self.objectsMinV = minV
		for obj in self.objectList:
			if obj.mesh == None:
				continue

			obj.mesh.vertexes -= numpy.array([minV[0] + (maxV[0] - minV[0]) / 2, minV[1] + (maxV[1] - minV[1]) / 2, minV[2]])
			obj.mesh.getMinimumZ()
			obj.dirty = True
		self.glCanvas.Refresh()
开发者ID:xtarn,项目名称:Cura-v2,代码行数:44,代码来源:preview3d.py

示例11: OnRotate

	def OnRotate(self, e):
		profile.putProfileSetting('model_rotate_base', self.rotate.GetValue())
		self.updateModelTransform()
开发者ID:bwattendorf,项目名称:Cura,代码行数:3,代码来源:preview3d.py

示例12: OnMulYSubClick

	def OnMulYSubClick(self, e):
		profile.putProfileSetting('model_multiply_y', str(max(1, int(profile.getProfileSetting('model_multiply_y'))-1)))
		self.glCanvas.Refresh()
开发者ID:bwattendorf,项目名称:Cura,代码行数:3,代码来源:preview3d.py

示例13: OnScale

	def OnScale(self, e):
		scale = 1.0
		if self.scale.GetValue() != '':
			scale = self.scale.GetValue()
		profile.putProfileSetting('model_scale', scale)
		self.glCanvas.Refresh()
开发者ID:bwattendorf,项目名称:Cura,代码行数:6,代码来源:preview3d.py

示例14: OnMulXAddClick

	def OnMulXAddClick(self, e):
		profile.putProfileSetting('model_multiply_x', str(max(1, int(profile.getProfileSetting('model_multiply_x'))+1)))
		self.glCanvas.Refresh()
开发者ID:bwattendorf,项目名称:Cura,代码行数:3,代码来源:preview3d.py

示例15: OnScale

	def OnScale(self, scale):
		self.scale = scale
		profile.putProfileSetting('model_scale', scale)
		self.glCanvas.Refresh()
开发者ID:xtarn,项目名称:Cura-v2,代码行数:4,代码来源:preview3d.py


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