本文整理汇总了Python中util.profile.getPreference函数的典型用法代码示例。如果您正苦于以下问题:Python getPreference函数的具体用法?Python getPreference怎么用?Python getPreference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPreference函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, port=None, baudrate=None):
if port == None:
port = profile.getPreference("serial_port")
if baudrate == None:
baudrate = int(profile.getPreference("serial_baud"))
self.serial = None
if port == "AUTO":
programmer = stk500v2.Stk500v2()
for port in serialList():
try:
print "Connecting to: %s %i" % (port, baudrate)
programmer.connect(port)
programmer.close()
time.sleep(1)
self.serial = Serial(port, baudrate, timeout=2)
break
except ispBase.IspError as (e):
print "Error while connecting to %s %i" % (port, baudrate)
print e
pass
except:
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
programmer.close()
elif port == "VIRTUAL":
self.serial = VirtualPrinter()
else:
try:
self.serial = Serial(port, baudrate, timeout=2)
except:
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
print self.serial
开发者ID:greenarrow,项目名称:Cura,代码行数:31,代码来源:machineCom.py
示例2: __init__
def __init__(self, port = None, baudrate = None, callbackObject = None):
if port == None:
port = profile.getPreference('serial_port')
if baudrate == None:
if profile.getPreference('serial_baud') == 'AUTO':
baudrate = 0
else:
baudrate = int(profile.getPreference('serial_baud'))
if callbackObject == None:
callbackObject = MachineComPrintCallback()
self._port = port
self._baudrate = baudrate
self._callback = callbackObject
self._state = self.STATE_NONE
self._serial = None
self._baudrateDetectList = baudrateList()
self._baudrateDetectRetry = 0
self._temp = 0
self._bedTemp = 0
self._targetTemp = 0
self._bedTargetTemp = 0
self._gcodeList = None
self._gcodePos = 0
self._commandQueue = queue.Queue()
self._logQueue = queue.Queue(256)
self._feedRateModifier = {}
self._currentZ = -1
self._heatupWaitStartTime = 0
self._heatupWaitTimeLost = 0.0
self._printStartTime100 = None
self.thread = threading.Thread(target=self._monitor)
self.thread.daemon = True
self.thread.start()
开发者ID:tinkerinestudio,项目名称:Coordia-beta,代码行数:35,代码来源:machineCom.py
示例3: __init__
def __init__(self, port = None, baudrate = None):
if port == None:
port = profile.getPreference('serial_port')
if baudrate == None:
if profile.getPreference('serial_baud') == 'AUTO':
baudrate = 0
else:
baudrate = int(profile.getPreference('serial_baud'))
self.serial = None
if port == 'AUTO':
programmer = stk500v2.Stk500v2()
for port in serialList():
try:
print "Connecting to: %s" % (port)
programmer.connect(port)
programmer.close()
time.sleep(1)
self.serial = self._openPortWithBaudrate(port, baudrate)
break
except ispBase.IspError as (e):
print "Error while connecting to %s" % (port)
print e
pass
except:
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
programmer.close()
elif port == 'VIRTUAL':
self.serial = VirtualPrinter()
else:
try:
self.serial = self._openPortWithBaudrate(port, baudrate)
except:
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
print self.serial
开发者ID:younew,项目名称:Cura,代码行数:34,代码来源:machineCom.py
示例4: __init__
def __init__(self, parent):
super(UltimakerCalibrateStepsPerEPage, self).__init__(parent, "Ultimaker Calibration")
if profile.getPreference('steps_per_e') == '0':
profile.putPreference('steps_per_e', '865.888')
self.AddText("Calibrating the Steps Per E requires some manual actions.")
self.AddText("First remove any filament from your machine.")
self.AddText("Next put in your filament so the tip is aligned with the\ntop of the extruder drive.")
self.AddText("We'll push the filament 100mm")
self.extrudeButton = self.AddButton("Extrude 100mm filament")
self.AddText("Now measure the amount of extruded filament:\n(this can be more or less then 100mm)")
p = wx.Panel(self)
p.SetSizer(wx.BoxSizer(wx.HORIZONTAL))
self.lengthInput = wx.TextCtrl(p, -1, '100')
p.GetSizer().Add(self.lengthInput, 0, wx.RIGHT, 8)
self.saveLengthButton = wx.Button(p, -1, 'Save')
p.GetSizer().Add(self.saveLengthButton, 0)
self.GetSizer().Add(p, 0, wx.LEFT, 5)
self.AddText("This results in the following steps per E:")
self.stepsPerEInput = wx.TextCtrl(self, -1, profile.getPreference('steps_per_e'))
self.GetSizer().Add(self.stepsPerEInput, 0, wx.LEFT, 5)
self.AddText("You can repeat these steps to get better calibration.")
self.AddSeperator()
self.AddText("If you still have filament in your printer which needs\nheat to remove, press the heat up button below:")
self.heatButton = self.AddButton("Heatup for filament removal")
self.saveLengthButton.Bind(wx.EVT_BUTTON, self.OnSaveLengthClick)
self.extrudeButton.Bind(wx.EVT_BUTTON, self.OnExtrudeClick)
self.heatButton.Bind(wx.EVT_BUTTON, self.OnHeatClick)
开发者ID:custodian,项目名称:Cura,代码行数:30,代码来源:configWizard.py
示例5: OnCopyToSD
def OnCopyToSD(self, e):
for f in self.filenameList:
exportFilename = sliceRun.getExportFilename(f)
filename = os.path.basename(exportFilename)
if profile.getPreference('sdshortnames') == 'True':
filename = sliceRun.getShortFilename(filename)
shutil.copy(exportFilename, os.path.join(profile.getPreference('sdpath'), filename))
开发者ID:custodian,项目名称:Cura,代码行数:7,代码来源:batchRun.py
示例6: main
def main():
# app = wx.App(False)
if profile.getPreference("machine_type") == "unknown":
configWizard.configWizard()
if profile.getPreference("startMode") == "Simple":
simpleMode.simpleModeWindow()
else:
mainWindow()
开发者ID:Lunavast,项目名称:Cura,代码行数:8,代码来源:mainWindow.py
示例7: baudrateList
def baudrateList():
ret = [250000, 230400, 115200, 57600, 38400, 19200, 9600]
if profile.getPreference('serial_baud_auto') != '':
prev = int(profile.getPreference('serial_baud_auto'))
if prev in ret:
ret.remove(prev)
ret.insert(0, prev)
return ret
开发者ID:tinkerinestudio,项目名称:Coordia-beta,代码行数:8,代码来源:machineCom.py
示例8: main
def main():
#app = wx.App(False)
if profile.getPreference('machine_type') == 'unknown':
configWizard.configWizard()
if profile.getPreference('startMode') == 'Simple':
simpleMode.simpleModeWindow()
else:
mainWindow()
开发者ID:festlv,项目名称:Cura,代码行数:8,代码来源:mainWindow.py
示例9: main
def main():
#app = wx.App(False)
if profile.getPreference('wizardDone') == 'False':
configWizard.configWizard()
profile.putPreference("wizardDone", "True")
if profile.getPreference('startMode') == 'Simple':
simpleMode.simpleModeWindow()
else:
mainWindow()
开发者ID:CNCBASHER,项目名称:Cura,代码行数:9,代码来源:mainWindow.py
示例10: main
def main():
app = wx.App(False)
if profile.getPreference("wizardDone") == "False":
configWizard.configWizard()
profile.putPreference("wizardDone", "True")
if profile.getPreference("startMode") == "Simple":
simpleMode.simpleModeWindow()
else:
mainWindow()
app.MainLoop()
开发者ID:younew,项目名称:Cura,代码行数:10,代码来源:mainWindow.py
示例11: OnCustomFirmware
def OnCustomFirmware(self, e):
if profile.getPreference('machine_type') == 'ultimaker':
wx.MessageBox('Warning: Installing a custom firmware does not garantee that you machine will function correctly, and could damage your machine.', 'Firmware update', wx.OK | wx.ICON_EXCLAMATION)
dlg=wx.FileDialog(self, "Open firmware to upload", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard("HEX file (*.hex)|*.hex;*.HEX")
if dlg.ShowModal() == wx.ID_OK:
filename = dlg.GetPath()
if not(os.path.exists(filename)):
return
#For some reason my Ubuntu 10.10 crashes here.
firmwareInstall.InstallFirmware(filename)
开发者ID:festlv,项目名称:Cura,代码行数:11,代码来源:mainWindow.py
示例12: OnSafeRemove
def OnSafeRemove(self):
if platform.system() == "Windows":
cmd = "%s %s>NUL" % (os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'EjectMedia.exe')), profile.getPreference('sdpath'))
elif platform.system() == "Darwin":
cmd = "diskutil eject '%s' > /dev/null 2>&1" % (profile.getPreference('sdpath'))
else:
cmd = "umount '%s' > /dev/null 2>&1" % (profile.getPreference('sdpath'))
if os.system(cmd):
self.GetParent().preview3d.ShowWarningPopup("Safe remove failed.")
else:
self.GetParent().preview3d.ShowWarningPopup("You can now eject the card.")
开发者ID:PKartaviy,项目名称:Cura,代码行数:11,代码来源:sliceProgessPanel.py
示例13: getDefaultFirmware
def getDefaultFirmware():
if profile.getPreference('machine_type') == 'ultimaker':
if profile.getPreferenceFloat('extruder_amount') > 1:
return None
if profile.getPreference('has_heated_bed') == 'True':
return None
if sys.platform.startswith('linux'):
return resources.getPathForFirmware("ultimaker_115200.hex")
else:
return resources.getPathForFirmware("ultimaker_250000.hex")
return None
开发者ID:tinkerinestudio,项目名称:Coordia-beta,代码行数:11,代码来源:firmwareInstall.py
示例14: OnSaveProfile
def OnSaveProfile(self, e):
dlg=wx.FileDialog(self, "Select profile file to save", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
dlg.SetWildcard("ini files (*.ini)|*.ini")
if dlg.ShowModal() == wx.ID_OK:
profileFile = dlg.GetPath()
profile.saveGlobalProfile(profileFile)
dlg.Destroy()
开发者ID:festlv,项目名称:Cura,代码行数:7,代码来源:mainWindow.py
示例15: __init__
def __init__(self, filename = None, port = None):
super(InstallFirmware, self).__init__(parent=None, title="Firmware install", size=(250, 100))
if port == None:
port = profile.getPreference('serial_port')
if filename == None:
filename = getDefaultFirmware()
if filename == None:
wx.MessageBox('Cura does not ship with a default firmware for your machine.', 'Firmware update', wx.OK | wx.ICON_ERROR)
self.Destroy()
return
sizer = wx.BoxSizer(wx.VERTICAL)
self.progressLabel = wx.StaticText(self, -1, 'Reading firmware...')
sizer.Add(self.progressLabel, 0, flag=wx.ALIGN_CENTER)
self.progressGauge = wx.Gauge(self, -1)
sizer.Add(self.progressGauge, 0, flag=wx.EXPAND)
self.okButton = wx.Button(self, -1, 'Ok')
self.okButton.Disable()
self.okButton.Bind(wx.EVT_BUTTON, self.OnOk)
sizer.Add(self.okButton, 0, flag=wx.ALIGN_CENTER)
self.SetSizer(sizer)
self.filename = filename
self.port = port
threading.Thread(target=self.OnRun).start()
self.ShowModal()
self.Destroy()
return
开发者ID:Ademan,项目名称:Cura,代码行数:31,代码来源:firmwareInstall.py
示例16: OnLoadProfileFromGcode
def OnLoadProfileFromGcode(self, e):
dlg = wx.FileDialog(
self,
"Select gcode file to load profile from",
os.path.split(profile.getPreference("lastFile"))[0],
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST,
)
dlg.SetWildcard("gcode files (*.gcode)|*.gcode")
if dlg.ShowModal() == wx.ID_OK:
gcodeFile = dlg.GetPath()
f = open(gcodeFile, "r")
hasProfile = False
for line in f:
if line.startswith(";CURA_PROFILE_STRING:"):
profile.loadGlobalProfileFromString(line[line.find(":") + 1 :].strip())
hasProfile = True
if hasProfile:
self.updateProfileToControls()
else:
wx.MessageBox(
"No profile found in GCode file.\nThis feature only works with GCode files made by Cura 12.07 or newer.",
"Profile load error",
wx.OK | wx.ICON_INFORMATION,
)
dlg.Destroy()
开发者ID:younew,项目名称:Cura,代码行数:25,代码来源:mainWindow.py
示例17: __init__
def __init__(self, parent):
wx.Panel.__init__(self, parent,-1)
self.alterationFileList = ['start.gcode', 'end.gcode', 'support_start.gcode', 'support_end.gcode', 'nextobject.gcode', 'replace.csv']
if int(profile.getPreference('extruder_amount')) > 1:
self.alterationFileList.append('switchExtruder.gcode')
self.currentFile = None
#self.textArea = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_DONTWRAP|wx.TE_PROCESS_TAB)
#self.textArea.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.textArea = gcodeTextArea.GcodeTextArea(self)
self.list = wx.ListBox(self, choices=self.alterationFileList, style=wx.LB_SINGLE)
self.list.SetSelection(0)
self.Bind(wx.EVT_LISTBOX, self.OnSelect, self.list)
self.textArea.Bind(wx.EVT_KILL_FOCUS, self.OnFocusLost, self.textArea)
self.textArea.Bind(wx.stc.EVT_STC_CHANGE, self.OnFocusLost, self.textArea)
sizer = wx.GridBagSizer()
sizer.Add(self.list, (0,0), span=(1,1), flag=wx.EXPAND)
sizer.Add(self.textArea, (0,1), span=(1,1), flag=wx.EXPAND)
sizer.AddGrowableCol(1)
sizer.AddGrowableRow(0)
self.SetSizer(sizer)
self.loadFile(self.alterationFileList[self.list.GetSelection()])
self.currentFile = self.list.GetSelection()
开发者ID:custodian,项目名称:Cura,代码行数:26,代码来源:alterationPanel.py
示例18: __init__
def __init__(self, parent):
super(preferencesDialog, self).__init__(title="Project Planner Preferences")
self.parent = parent
wx.EVT_CLOSE(self, self.OnClose)
extruderAmount = int(profile.getPreference('extruder_amount'))
left, right, main = self.CreateConfigPanel(self)
configBase.TitleRow(left, 'Machine head size')
c = configBase.SettingRow(left, 'Head size - X towards home (mm)', 'extruder_head_size_min_x', '0', 'Size of your printer head in the X direction, on the Ultimaker your fan is in this direction.', type = 'preference')
validators.validFloat(c, 0.1)
c = configBase.SettingRow(left, 'Head size - X towards end (mm)', 'extruder_head_size_max_x', '0', 'Size of your printer head in the X direction.', type = 'preference')
validators.validFloat(c, 0.1)
c = configBase.SettingRow(left, 'Head size - Y towards home (mm)', 'extruder_head_size_min_y', '0', 'Size of your printer head in the Y direction.', type = 'preference')
validators.validFloat(c, 0.1)
c = configBase.SettingRow(left, 'Head size - Y towards end (mm)', 'extruder_head_size_max_y', '0', 'Size of your printer head in the Y direction.', type = 'preference')
validators.validFloat(c, 0.1)
c = configBase.SettingRow(left, 'Head gantry height (mm)', 'extruder_head_size_height', '0', 'The tallest object height that will always fit under your printers gantry system when the printer head is at the lowest Z position.', type = 'preference')
validators.validFloat(c)
self.okButton = wx.Button(left, -1, 'Ok')
left.GetSizer().Add(self.okButton, (left.GetSizer().GetRows(), 1))
self.okButton.Bind(wx.EVT_BUTTON, self.OnClose)
self.MakeModal(True)
main.Fit()
self.Fit()
开发者ID:custodian,项目名称:Cura,代码行数:28,代码来源:projectPlanner.py
示例19: 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))
开发者ID:greenarrow,项目名称:Cura,代码行数:7,代码来源:configBase.py
示例20: OnSaveProject
def OnSaveProject(self, e):
dlg=wx.FileDialog(self, "Save project file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
dlg.SetWildcard("Project files (*.curaproject)|*.curaproject")
if dlg.ShowModal() == wx.ID_OK:
cp = ConfigParser.ConfigParser()
i = 0
for item in self.list:
section = 'model_%d' % (i)
cp.add_section(section)
cp.set(section, 'filename', item.filename.encode("utf-8"))
cp.set(section, 'centerX', str(item.centerX))
cp.set(section, 'centerY', str(item.centerY))
cp.set(section, 'scale', str(item.scale))
cp.set(section, 'rotate', str(item.rotate))
cp.set(section, 'flipX', str(item.flipX))
cp.set(section, 'flipY', str(item.flipY))
cp.set(section, 'flipZ', str(item.flipZ))
cp.set(section, 'swapXZ', str(item.swapXZ))
cp.set(section, 'swapYZ', str(item.swapYZ))
cp.set(section, 'extruder', str(item.extruder+1))
if item.profile != None:
cp.set(section, 'profile', item.profile)
i += 1
cp.write(open(dlg.GetPath(), "w"))
dlg.Destroy()
开发者ID:custodian,项目名称:Cura,代码行数:25,代码来源:projectPlanner.py
注:本文中的util.profile.getPreference函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论