本文整理汇总了Python中util.profile.getProfileSetting函数的典型用法代码示例。如果您正苦于以下问题:Python getProfileSetting函数的具体用法?Python getProfileSetting怎么用?Python getProfileSetting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getProfileSetting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(
self,
parent,
profileSetting,
bitmapFilenameOn,
bitmapFilenameOff,
helpText="",
id=-1,
callback=None,
size=(20, 20),
):
self.bitmapOn = getBitmapImage(bitmapFilenameOn)
self.bitmapOff = getBitmapImage(bitmapFilenameOff)
super(ToggleButton, self).__init__(parent, id, self.bitmapOff, size=size)
self.callback = callback
self.profileSetting = profileSetting
self.helpText = helpText
self.SetBezelWidth(1)
self.SetUseFocusIndicator(False)
if self.profileSetting != "":
self.SetValue(profile.getProfileSetting(self.profileSetting) == "True")
self.Bind(wx.EVT_BUTTON, self.OnButtonProfile)
else:
self.Bind(wx.EVT_BUTTON, self.OnButton)
self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
parent.AddControl(self)
示例2: updateProfileToControls
def updateProfileToControls(self):
"Update the configuration wx controls to show the new configuration settings"
for setting in self.settingControlList:
if setting.type == "profile":
setting.SetValue(profile.getProfileSetting(setting.configName))
else:
setting.SetValue(profile.getPreference(setting.configName))
示例3: _doAutoPlace
def _doAutoPlace(self, allowedSizeY):
extraSizeMin = self.headSizeMin
extraSizeMax = self.headSizeMax
if profile.getProfileSettingFloat('skirt_line_count') > 0:
skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
extraSizeMin = extraSizeMin + util3d.Vector3(skirtSize, skirtSize, 0)
extraSizeMax = extraSizeMax + util3d.Vector3(skirtSize, skirtSize, 0)
if profile.getProfileSetting('support') != 'None':
extraSizeMin = extraSizeMin + util3d.Vector3(3.0, 0, 0)
extraSizeMax = extraSizeMax + util3d.Vector3(3.0, 0, 0)
if self.printMode == 1:
extraSizeMin = util3d.Vector3(6.0, 6.0, 0)
extraSizeMax = util3d.Vector3(6.0, 6.0, 0)
if extraSizeMin.x > extraSizeMax.x:
posX = self.machineSize.x
dirX = -1
else:
posX = 0
dirX = 1
posY = 0
dirY = 1
minX = self.machineSize.x
minY = self.machineSize.y
maxX = 0
maxY = 0
for item in self.list:
item.centerX = posX + item.getMaximum().x * item.scale * dirX
item.centerY = posY + item.getMaximum().y * item.scale * dirY
if item.centerY + item.getSize().y >= allowedSizeY:
if dirX < 0:
posX = minX - extraSizeMax.x - 1
else:
posX = maxX + extraSizeMin.x + 1
posY = 0
item.centerX = posX + item.getMaximum().x * item.scale * dirX
item.centerY = posY + item.getMaximum().y * item.scale * dirY
posY += item.getSize().y * item.scale * dirY + extraSizeMin.y + 1
minX = min(minX, item.centerX - item.getSize().x * item.scale / 2)
minY = min(minY, item.centerY - item.getSize().y * item.scale / 2)
maxX = max(maxX, item.centerX + item.getSize().x * item.scale / 2)
maxY = max(maxY, item.centerY + item.getSize().y * item.scale / 2)
for item in self.list:
if dirX < 0:
item.centerX -= minX / 2
else:
item.centerX += (self.machineSize.x - maxX) / 2
item.centerY += (self.machineSize.y - maxY) / 2
if minX < 0 or maxX > self.machineSize.x:
return ((maxX - minX) + (maxY - minY)) * 100
return (maxX - minX) + (maxY - minY)
示例4: getExtraHeadSize
def getExtraHeadSize(self):
extraSizeMin = self.headSizeMin
extraSizeMax = self.headSizeMax
if profile.getProfileSettingFloat('skirt_line_count') > 0:
skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
extraSizeMin = extraSizeMin + numpy.array([skirtSize, skirtSize, 0])
extraSizeMax = extraSizeMax + numpy.array([skirtSize, skirtSize, 0])
if profile.getProfileSetting('enable_raft') != 'False':
raftSize = profile.getProfileSettingFloat('raft_margin') * 2
extraSizeMin = extraSizeMin + numpy.array([raftSize, raftSize, 0])
extraSizeMax = extraSizeMax + numpy.array([raftSize, raftSize, 0])
if profile.getProfileSetting('support') != 'None':
extraSizeMin = extraSizeMin + numpy.array([3.0, 0, 0])
extraSizeMax = extraSizeMax + numpy.array([3.0, 0, 0])
if self.printMode == 1:
extraSizeMin = numpy.array([6.0, 6.0, 0])
extraSizeMax = numpy.array([6.0, 6.0, 0])
return extraSizeMin, extraSizeMax
示例5: updateModelTransform
def updateModelTransform(self, f=0):
if len(self.objectList) < 1 or self.objectList[0].mesh == None:
return
rotate = profile.getProfileSettingFloat('model_rotate_base')
mirrorX = profile.getProfileSetting('flip_x') == 'True'
mirrorY = profile.getProfileSetting('flip_y') == 'True'
mirrorZ = profile.getProfileSetting('flip_z') == 'True'
swapXZ = profile.getProfileSetting('swap_xz') == 'True'
swapYZ = profile.getProfileSetting('swap_yz') == 'True'
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]])
#for v in obj.mesh.vertexes:
# v[2] -= minV[2]
# v[0] -= minV[0] + (maxV[0] - minV[0]) / 2
# v[1] -= minV[1] + (maxV[1] - minV[1]) / 2
obj.mesh.getMinimumZ()
obj.dirty = True
self.glCanvas.Refresh()
示例6: updateModelTransform
def updateModelTransform(self, f=0):
if len(self.objectList) < 1 or self.objectList[0].mesh == None:
return
rotate = profile.getProfileSettingFloat('model_rotate_base')
mirrorX = profile.getProfileSetting('flip_x') == 'True'
mirrorY = profile.getProfileSetting('flip_y') == 'True'
mirrorZ = profile.getProfileSetting('flip_z') == 'True'
swapXZ = profile.getProfileSetting('swap_xz') == 'True'
swapYZ = profile.getProfileSetting('swap_yz') == 'True'
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 = minV.min(obj.mesh.getMinimum())
maxV = maxV.max(obj.mesh.getMaximum())
self.objectsMaxV = maxV
self.objectsMinV = minV
for obj in self.objectList:
if obj.mesh == None:
continue
for v in obj.mesh.vertexes:
v.z -= minV.z
v.x -= minV.x + (maxV.x - minV.x) / 2
v.y -= minV.y + (maxV.y - minV.y) / 2
obj.mesh.getMinimumZ()
obj.dirty = True
self.glCanvas.Refresh()
示例7: updateProfileToControls
def updateProfileToControls(self):
self.scale.SetValue(profile.getProfileSetting('model_scale'))
self.rotate.SetValue(profile.getProfileSettingFloat('model_rotate_base'))
self.mirrorX.SetValue(profile.getProfileSetting('flip_x') == 'True')
self.mirrorY.SetValue(profile.getProfileSetting('flip_y') == 'True')
self.mirrorZ.SetValue(profile.getProfileSetting('flip_z') == 'True')
self.swapXZ.SetValue(profile.getProfileSetting('swap_xz') == 'True')
self.swapYZ.SetValue(profile.getProfileSetting('swap_yz') == 'True')
self.updateModelTransform()
示例8: __init__
def __init__(self, parent):
super(UltimakerCalibrationPage, self).__init__(parent, "Ultimaker Calibration")
self.AddText("Your Ultimaker requires some calibration.")
self.AddText("This calibration is needed for a proper extrusion amount.")
self.AddSeperator()
self.AddText("The following values are needed:")
self.AddText("* Diameter of filament")
self.AddText("* Number of steps per mm of filament extrusion")
self.AddSeperator()
self.AddText("The better you have calibrated these values, the better your prints\nwill become.")
self.AddSeperator()
self.AddText("First we need the diameter of your filament:")
self.filamentDiameter = self.AddTextCtrl(profile.getProfileSetting('filament_diameter'))
self.AddText("If you do not own digital Calipers that can measure\nat least 2 digits then use 2.89mm.\nWhich is the average diameter of most filament.")
self.AddText("Note: This value can be changed later at any time.")
示例9: StoreData
def StoreData(self):
if self.UltimakerRadio.GetValue():
profile.putPreference("machine_width", "205")
profile.putPreference("machine_depth", "205")
profile.putPreference("machine_height", "200")
profile.putProfileSetting("nozzle_size", "0.4")
profile.putProfileSetting("machine_center_x", "100")
profile.putProfileSetting("machine_center_y", "100")
else:
profile.putPreference("machine_width", "80")
profile.putPreference("machine_depth", "80")
profile.putPreference("machine_height", "60")
profile.putProfileSetting("nozzle_size", "0.5")
profile.putProfileSetting("machine_center_x", "40")
profile.putProfileSetting("machine_center_y", "40")
profile.putProfileSetting("wall_thickness", float(profile.getProfileSetting("nozzle_size")) * 2)
示例10: StoreData
def StoreData(self):
if self.UltimakerRadio.GetValue():
profile.putPreference('machine_width', '205')
profile.putPreference('machine_depth', '205')
profile.putPreference('machine_height', '200')
profile.putProfileSetting('nozzle_size', '0.4')
profile.putProfileSetting('machine_center_x', '100')
profile.putProfileSetting('machine_center_y', '100')
else:
profile.putPreference('machine_width', '80')
profile.putPreference('machine_depth', '80')
profile.putPreference('machine_height', '60')
profile.putProfileSetting('nozzle_size', '0.5')
profile.putProfileSetting('machine_center_x', '40')
profile.putProfileSetting('machine_center_y', '40')
profile.putProfileSetting('wall_thickness', float(profile.getProfileSetting('nozzle_size')) * 2)
示例11: raftLayerCount
def raftLayerCount(setting):
if profile.getProfileSetting('enable_raft') == "True":
return '1'
return '0'
示例12: ifSettingIs
def ifSettingIs(name, value):
return lambda setting: profile.getProfileSetting(name) == value
示例13: storedSettingInvertBoolean
def storedSettingInvertBoolean(name):
return lambda setting: profile.getProfileSetting(name) == "False"
示例14: storedSetting
def storedSetting(name):
return lambda setting: profile.getProfileSetting(name)
示例15: __init__
def __init__(self, parent):
super(previewPanel, self).__init__(parent,-1)
self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DDKSHADOW))
self.SetMinSize((440,320))
self.objectList = []
self.errorList = []
self.gcode = None
self.objectsMinV = None
self.objectsMaxV = None
self.loadThread = None
self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height'))
self.machineCenter = util3d.Vector3(float(profile.getProfileSetting('machine_center_x')), float(profile.getProfileSetting('machine_center_y')), 0)
self.glCanvas = PreviewGLCanvas(self)
#Create the popup window
self.warningPopup = wx.PopupWindow(self, flags=wx.BORDER_SIMPLE)
self.warningPopup.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK))
self.warningPopup.text = wx.StaticText(self.warningPopup, -1, 'Reset scale, rotation and mirror?')
self.warningPopup.yesButton = wx.Button(self.warningPopup, -1, 'yes', style=wx.BU_EXACTFIT)
self.warningPopup.noButton = wx.Button(self.warningPopup, -1, 'no', style=wx.BU_EXACTFIT)
self.warningPopup.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.warningPopup.SetSizer(self.warningPopup.sizer)
self.warningPopup.sizer.Add(self.warningPopup.text, 1, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=1)
self.warningPopup.sizer.Add(self.warningPopup.yesButton, 0, flag=wx.EXPAND|wx.ALL, border=1)
self.warningPopup.sizer.Add(self.warningPopup.noButton, 0, flag=wx.EXPAND|wx.ALL, border=1)
self.warningPopup.Fit()
self.warningPopup.Layout()
self.warningPopup.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer)
self.Bind(wx.EVT_BUTTON, self.OnResetAll, self.warningPopup.yesButton)
self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton)
parent.Bind(wx.EVT_MOVE, self.OnMove)
parent.Bind(wx.EVT_SIZE, self.OnMove)
self.toolbar = toolbarUtil.Toolbar(self)
group = []
toolbarUtil.RadioButton(self.toolbar, group, 'object-3d-on.png', 'object-3d-off.png', '3D view', callback=self.On3DClick)
toolbarUtil.RadioButton(self.toolbar, group, 'object-top-on.png', 'object-top-off.png', 'Topdown view', callback=self.OnTopClick)
self.toolbar.AddSeparator()
self.showBorderButton = toolbarUtil.ToggleButton(self.toolbar, '', 'view-border-on.png', 'view-border-off.png', 'Show model borders', callback=self.OnViewChange)
self.toolbar.AddSeparator()
group = []
self.normalViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-normal-on.png', 'view-normal-off.png', 'Normal model view', callback=self.OnViewChange)
self.transparentViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-transparent-on.png', 'view-transparent-off.png', 'Transparent model view', callback=self.OnViewChange)
self.xrayViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-xray-on.png', 'view-xray-off.png', 'X-Ray view', callback=self.OnViewChange)
self.gcodeViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-gcode-on.png', 'view-gcode-off.png', 'GCode view', callback=self.OnViewChange)
self.mixedViewButton = toolbarUtil.RadioButton(self.toolbar, group, 'view-mixed-on.png', 'view-mixed-off.png', 'Mixed model/GCode view', callback=self.OnViewChange)
self.toolbar.AddSeparator()
self.layerSpin = wx.SpinCtrl(self.toolbar, -1, '', size=(21*4,21), style=wx.SP_ARROW_KEYS)
self.toolbar.AddControl(self.layerSpin)
self.Bind(wx.EVT_SPINCTRL, self.OnLayerNrChange, self.layerSpin)
self.toolbar2 = toolbarUtil.Toolbar(self)
# Mirror
self.mirrorX = toolbarUtil.ToggleButton(self.toolbar2, 'flip_x', 'object-mirror-x-on.png', 'object-mirror-x-off.png', 'Mirror X', callback=self.updateModelTransform)
self.mirrorY = toolbarUtil.ToggleButton(self.toolbar2, 'flip_y', 'object-mirror-y-on.png', 'object-mirror-y-off.png', 'Mirror Y', callback=self.updateModelTransform)
self.mirrorZ = toolbarUtil.ToggleButton(self.toolbar2, 'flip_z', 'object-mirror-z-on.png', 'object-mirror-z-off.png', 'Mirror Z', callback=self.updateModelTransform)
self.toolbar2.AddSeparator()
# Swap
self.swapXZ = toolbarUtil.ToggleButton(self.toolbar2, 'swap_xz', 'object-swap-xz-on.png', 'object-swap-xz-off.png', 'Swap XZ', callback=self.updateModelTransform)
self.swapYZ = toolbarUtil.ToggleButton(self.toolbar2, 'swap_yz', 'object-swap-yz-on.png', 'object-swap-yz-off.png', 'Swap YZ', callback=self.updateModelTransform)
self.toolbar2.AddSeparator()
# Scale
self.scaleReset = toolbarUtil.NormalButton(self.toolbar2, self.OnScaleReset, 'object-scale.png', 'Reset model scale')
self.scale = wx.TextCtrl(self.toolbar2, -1, profile.getProfileSetting('model_scale'), size=(21*2,21))
self.toolbar2.AddControl(self.scale)
self.scale.Bind(wx.EVT_TEXT, self.OnScale)
self.scaleMax = toolbarUtil.NormalButton(self.toolbar2, self.OnScaleMax, 'object-max-size.png', 'Scale object to fit machine size')
self.toolbar2.AddSeparator()
# Multiply
#self.mulXadd = toolbarUtil.NormalButton(self.toolbar2, self.OnMulXAddClick, 'object-mul-x-add.png', 'Increase number of models on X axis')
#self.mulXsub = toolbarUtil.NormalButton(self.toolbar2, self.OnMulXSubClick, 'object-mul-x-sub.png', 'Decrease number of models on X axis')
#self.mulYadd = toolbarUtil.NormalButton(self.toolbar2, self.OnMulYAddClick, 'object-mul-y-add.png', 'Increase number of models on Y axis')
#self.mulYsub = toolbarUtil.NormalButton(self.toolbar2, self.OnMulYSubClick, 'object-mul-y-sub.png', 'Decrease number of models on Y axis')
#self.toolbar2.AddSeparator()
# Rotate
self.rotateReset = toolbarUtil.NormalButton(self.toolbar2, self.OnRotateReset, 'object-rotate.png', 'Reset model rotation')
self.rotate = wx.SpinCtrl(self.toolbar2, -1, profile.getProfileSetting('model_rotate_base'), size=(21*3,21), style=wx.SP_WRAP|wx.SP_ARROW_KEYS)
self.rotate.SetRange(0, 360)
self.rotate.Bind(wx.EVT_TEXT, self.OnRotate)
self.toolbar2.AddControl(self.rotate)
self.toolbar2.Realize()
self.OnViewChange()
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.toolbar, 0, flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, border=1)
#.........这里部分代码省略.........