mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-06 06:09:19 +08:00
Renamed DepthComplexity to XRay in code
Added working steps per E calibration Fixed checkboxes being unchecked always on first run
This commit is contained in:
parent
5bb5c3640b
commit
fdb3a32a40
@ -116,13 +116,11 @@ class SettingRow():
|
||||
self.ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange)
|
||||
elif isinstance(defaultValue, types.BooleanType):
|
||||
self.ctrl = wx.CheckBox(panel, -1, style=wx.ALIGN_RIGHT)
|
||||
self.ctrl.SetValue(getSettingFunc(configName, defaultValue) == "True")
|
||||
self.SetValue(getSettingFunc(configName, defaultValue))
|
||||
self.ctrl.Bind(wx.EVT_CHECKBOX, self.OnSettingChange)
|
||||
else:
|
||||
self.ctrl = wx.ComboBox(panel, -1, getSettingFunc(configName, defaultValue[0]), choices=defaultValue, style=wx.CB_DROPDOWN|wx.CB_READONLY)
|
||||
self.ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange)
|
||||
#self.helpButton = wx.Button(panel, -1, "?", style=wx.BU_EXACTFIT)
|
||||
#self.helpButton.SetToolTip(wx.ToolTip(help))
|
||||
|
||||
self.ctrl.Bind(wx.EVT_ENTER_WINDOW, lambda e: panel.main.OnPopupDisplay(self))
|
||||
self.ctrl.Bind(wx.EVT_LEAVE_WINDOW, panel.main.OnPopupHide)
|
||||
@ -131,7 +129,6 @@ class SettingRow():
|
||||
|
||||
sizer.Add(self.label, (x,y), flag=wx.ALIGN_CENTER_VERTICAL)
|
||||
sizer.Add(self.ctrl, (x,y+1), flag=wx.ALIGN_BOTTOM|wx.EXPAND)
|
||||
#sizer.Add(helpButton, (x,y+2))
|
||||
sizer.SetRows(x+1)
|
||||
|
||||
def OnSettingChange(self, e):
|
||||
|
@ -36,6 +36,11 @@ class InfoPage(wx.wizard.WizardPageSimple):
|
||||
self.GetSizer().Add(radio, 0, wx.EXPAND|wx.ALL, 5)
|
||||
return radio
|
||||
|
||||
def AddButton(self, label):
|
||||
button = wx.Button(self, -1, label)
|
||||
self.GetSizer().Add(button, 0, wx.LEFT, 5)
|
||||
return button
|
||||
|
||||
def AddDualButton(self, label1, label2):
|
||||
p = wx.Panel(self)
|
||||
p.SetSizer(wx.BoxSizer(wx.HORIZONTAL))
|
||||
@ -43,7 +48,7 @@ class InfoPage(wx.wizard.WizardPageSimple):
|
||||
p.GetSizer().Add(button1, 0, wx.RIGHT, 8)
|
||||
button2 = wx.Button(p, -1, label2)
|
||||
p.GetSizer().Add(button2, 0)
|
||||
self.GetSizer().Add(p, 0)
|
||||
self.GetSizer().Add(p, 0, wx.LEFT, 5)
|
||||
return button1, button2
|
||||
|
||||
def AllowNext(self):
|
||||
@ -119,9 +124,8 @@ class FirmwareUpgradePage(InfoPage):
|
||||
self.AddText('* You have an older machine based on ATMega1280')
|
||||
self.AddText('* Using an LCD panel')
|
||||
self.AddText('* Have other changes in the firmware')
|
||||
button = wx.Button(self, -1, 'Goto this page for a custom firmware')
|
||||
button = self.AddButton('Goto this page for a custom firmware')
|
||||
button.Bind(wx.EVT_BUTTON, self.OnUrlClick)
|
||||
self.GetSizer().Add(button, 0)
|
||||
|
||||
def AllowNext(self):
|
||||
return False
|
||||
@ -299,12 +303,51 @@ class UltimakerCalibrateStepsPerEPage(InfoPage):
|
||||
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.AddText("[BUTTON:PUSH 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)")
|
||||
self.AddText("[INPUT:MEASUREMENT][BUTTON:SAVE]")
|
||||
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.AddText("[INPUT:E_RESULT]")
|
||||
self.stepsPerEInput = wx.TextCtrl(self, -1, settings.getPreference('steps_per_e', '865.888'))
|
||||
self.GetSizer().Add(self.stepsPerEInput, 0, wx.LEFT, 5)
|
||||
self.AddText("You can repeat these steps to get better calibration.")
|
||||
|
||||
self.saveLengthButton.Bind(wx.EVT_BUTTON, self.OnSaveLengthClick)
|
||||
self.extrudeButton.Bind(wx.EVT_BUTTON, self.OnExtrudeClick)
|
||||
|
||||
def OnSaveLengthClick(self, e):
|
||||
currentEValue = float(self.stepsPerEInput.GetValue())
|
||||
realExtrudeLength = float(self.lengthInput.GetValue())
|
||||
newEValue = currentEValue * 100 / realExtrudeLength
|
||||
self.stepsPerEInput.SetValue(str(newEValue))
|
||||
self.lengthInput.SetValue("100")
|
||||
|
||||
def OnExtrudeClick(self, e):
|
||||
threading.Thread(target=self.OnRun).start()
|
||||
|
||||
def OnRun(self):
|
||||
self.comm = machineCom.MachineCom()
|
||||
self.sendGCommand('M302') #Disable cold extrusion protection
|
||||
self.sendGCommand("G92 E0");
|
||||
self.sendGCommand("G1 E100 F300");
|
||||
self.comm.close()
|
||||
|
||||
def sendGCommand(self, cmd):
|
||||
self.comm.sendCommand(cmd) #Disable cold extrusion protection
|
||||
while True:
|
||||
line = self.comm.readline()
|
||||
if line == '':
|
||||
return
|
||||
if line.startswith('ok'):
|
||||
break
|
||||
|
||||
def StoreData(self):
|
||||
settings.putPreference('steps_per_e', self.stepsPerEInput.GetValue())
|
||||
|
||||
class configWizard(wx.wizard.Wizard):
|
||||
def __init__(self):
|
||||
|
@ -32,6 +32,9 @@ class mainWindow(configBase.configWindowBase):
|
||||
|
||||
menubar = wx.MenuBar()
|
||||
fileMenu = wx.Menu()
|
||||
i = fileMenu.Append(-1, 'Load STL file...')
|
||||
self.Bind(wx.EVT_MENU, self.OnLoadSTL, i)
|
||||
fileMenu.AppendSeparator()
|
||||
i = fileMenu.Append(-1, 'Open Profile...')
|
||||
self.Bind(wx.EVT_MENU, self.OnLoadProfile, i)
|
||||
i = fileMenu.Append(-1, 'Save Profile...')
|
||||
@ -52,6 +55,9 @@ class mainWindow(configBase.configWindowBase):
|
||||
self.Bind(wx.EVT_MENU, self.OnDefaultMarlinFirmware, i)
|
||||
i = expertMenu.Append(-1, 'Install custom firmware')
|
||||
self.Bind(wx.EVT_MENU, self.OnCustomFirmware, i)
|
||||
expertMenu.AppendSeparator()
|
||||
i = expertMenu.Append(-1, 'ReRun first run wizard...')
|
||||
self.Bind(wx.EVT_MENU, self.OnFirstRunWizard, i)
|
||||
menubar.Append(expertMenu, 'Expert')
|
||||
self.SetMenuBar(menubar)
|
||||
|
||||
@ -93,7 +99,6 @@ class mainWindow(configBase.configWindowBase):
|
||||
validators.validFloat(c, 1.0)
|
||||
validators.warningAbove(c, 150.0, "It is highly unlikely that your machine can achieve a printing speed above 150mm/s")
|
||||
|
||||
#Printing temperature is a problem right now, as our start code depends on a heated head.
|
||||
configBase.TitleRow(right, "Temperature")
|
||||
c = configBase.SettingRow(right, "Printing temperature", 'print_temperature', '0', 'Temperature used for printing. Set at 0 to pre-heat yourself')
|
||||
validators.validFloat(c, 0.0, 340.0)
|
||||
@ -171,6 +176,8 @@ class mainWindow(configBase.configWindowBase):
|
||||
sliceButton = wx.Button(self, -1, 'Slice to GCode')
|
||||
self.Bind(wx.EVT_BUTTON, self.OnLoadSTL, loadButton)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnSlice, sliceButton)
|
||||
#Also bind double clicking the 3D preview to load an STL file.
|
||||
self.preview3d.glCanvas.Bind(wx.EVT_LEFT_DCLICK, self.OnLoadSTL, self.preview3d.glCanvas)
|
||||
|
||||
#Main sizer, to position the preview window, buttons and tab control
|
||||
sizer = wx.GridBagSizer()
|
||||
@ -230,6 +237,9 @@ class mainWindow(configBase.configWindowBase):
|
||||
#For some reason my Ubuntu 10.10 crashes here.
|
||||
machineCom.InstallFirmware(filename, settings.getPreference('serial_port', 'AUTO'))
|
||||
|
||||
def OnFirstRunWizard(self, e):
|
||||
configWizard.configWizard()
|
||||
|
||||
def OnLoadSTL(self, e):
|
||||
dlg=wx.FileDialog(self, "Open file to print", self.lastPath, style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
|
||||
dlg.SetWildcard("OBJ, STL files (*.stl;*.obj)|*.stl;*.obj")
|
||||
@ -281,4 +291,3 @@ class mainWindow(configBase.configWindowBase):
|
||||
def OnClose(self, e):
|
||||
settings.saveGlobalProfile(settings.getDefaultProfilePath())
|
||||
self.Destroy()
|
||||
|
||||
|
@ -47,9 +47,9 @@ class previewPanel(wx.Panel):
|
||||
self.transparentButton = wx.Button(self.toolbar, -1, "T", size=(21,21))
|
||||
self.toolbar.AddControl(self.transparentButton)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnTransparentClick, self.transparentButton)
|
||||
self.depthComplexityButton = wx.Button(self.toolbar, -1, "X-RAY", size=(21*2,21))
|
||||
self.toolbar.AddControl(self.depthComplexityButton)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnDepthComplexityClick, self.depthComplexityButton)
|
||||
self.XRayButton = wx.Button(self.toolbar, -1, "X-RAY", size=(21*2,21))
|
||||
self.toolbar.AddControl(self.XRayButton)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnXRayClick, self.XRayButton)
|
||||
|
||||
self.layerSpin = wx.SpinCtrl(self.toolbar, -1, '', size=(21*4,21), style=wx.SP_ARROW_KEYS)
|
||||
self.toolbar.AddControl(self.layerSpin)
|
||||
@ -131,7 +131,7 @@ class previewPanel(wx.Panel):
|
||||
|
||||
def updateToolbar(self):
|
||||
self.transparentButton.Show(self.triangleMesh != None)
|
||||
self.depthComplexityButton.Show(self.triangleMesh != None)
|
||||
self.XRayButton.Show(self.triangleMesh != None)
|
||||
self.layerSpin.Show(self.gcode != None)
|
||||
if self.gcode != None:
|
||||
self.layerSpin.SetRange(1, self.gcode.layerCount)
|
||||
@ -140,12 +140,12 @@ class previewPanel(wx.Panel):
|
||||
def OnTransparentClick(self, e):
|
||||
self.glCanvas.renderTransparent = not self.glCanvas.renderTransparent
|
||||
if self.glCanvas.renderTransparent:
|
||||
self.glCanvas.renderDepthComplexity = False
|
||||
self.glCanvas.renderXRay = False
|
||||
self.glCanvas.Refresh()
|
||||
|
||||
def OnDepthComplexityClick(self, e):
|
||||
self.glCanvas.renderDepthComplexity = not self.glCanvas.renderDepthComplexity
|
||||
if self.glCanvas.renderDepthComplexity:
|
||||
def OnXRayClick(self, e):
|
||||
self.glCanvas.renderXRay = not self.glCanvas.renderXRay
|
||||
if self.glCanvas.renderXRay:
|
||||
self.glCanvas.renderTransparent = False
|
||||
self.glCanvas.Refresh()
|
||||
|
||||
@ -217,9 +217,9 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||
self.fillLineWidth = 0.4
|
||||
self.view3D = True
|
||||
self.renderTransparent = False
|
||||
self.renderDepthComplexity = False
|
||||
self.renderXRay = False
|
||||
self.modelDisplayList = None
|
||||
|
||||
|
||||
def OnMouseMotion(self,e):
|
||||
if e.Dragging() and e.LeftIsDown():
|
||||
if self.view3D:
|
||||
@ -405,7 +405,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||
glBlendFunc(GL_ONE, GL_ONE)
|
||||
glEnable(GL_LIGHTING)
|
||||
glCallList(self.modelDisplayList)
|
||||
elif self.renderDepthComplexity:
|
||||
elif self.renderXRay:
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)
|
||||
glDisable(GL_DEPTH_TEST)
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
|
Loading…
x
Reference in New Issue
Block a user