def __init__(self, mainWindow, parent, filelist):
		wx.Panel.__init__(self, parent, -1)
		self.mainWindow = mainWindow
		self.filelist = filelist
		self.abort = False
		
		box = wx.StaticBox(self, -1, filelist[0])
		self.sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

		mainSizer = wx.BoxSizer(wx.VERTICAL) 
		mainSizer.Add(self.sizer, 0, flag=wx.EXPAND)

		self.statusText = wx.StaticText(self, -1, "Starting...")
		self.progressGauge = wx.Gauge(self, -1)
		self.progressGauge.SetRange(10000 * len(filelist))
		self.abortButton = wx.Button(self, -1, "X", style=wx.BU_EXACTFIT)
		self.sizer.Add(self.statusText, 2, flag=wx.ALIGN_CENTER )
		self.sizer.Add(self.progressGauge, 2)
		self.sizer.Add(self.abortButton, 0)

		self.Bind(wx.EVT_BUTTON, self.OnAbort, self.abortButton)

		self.SetSizer(mainSizer)
		self.prevStep = 'start'
		self.totalDoneFactor = 0.0
		self.startTime = time.time()
		if profile.getPreference('save_profile') == 'True':
			profile.saveGlobalProfile(self.filelist[0][: self.filelist[0].rfind('.')] + "_profile.ini")
		center = profile.getMachineCenterCoords() + profile.getObjectMatrix()
		cmdList = [sliceRun.getSliceCommand(sliceRun.getExportFilename(self.filelist[0]), ['|'.join(self.filelist)], [center])]
		self.thread = WorkerThread(self, filelist, cmdList)
Beispiel #2
0
    def __init__(self, mainWindow, parent, filelist):
        wx.Panel.__init__(self, parent, -1)
        self.mainWindow = mainWindow
        self.filelist = filelist
        self.abort = False

        box = wx.StaticBox(self, -1, filelist[0])
        self.sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.sizer, 0, flag=wx.EXPAND)

        self.statusText = wx.StaticText(self, -1, "Starting...")
        self.progressGauge = wx.Gauge(self, -1)
        self.progressGauge.SetRange(10000 * len(filelist))
        self.abortButton = wx.Button(self, -1, "X", style=wx.BU_EXACTFIT)
        self.sizer.Add(self.statusText, 2, flag=wx.ALIGN_CENTER)
        self.sizer.Add(self.progressGauge, 2)
        self.sizer.Add(self.abortButton, 0)

        self.Bind(wx.EVT_BUTTON, self.OnAbort, self.abortButton)

        self.SetSizer(mainSizer)
        self.prevStep = 'start'
        self.totalDoneFactor = 0.0
        self.startTime = time.time()
        if profile.getPreference('save_profile') == 'True':
            profile.saveGlobalProfile(
                self.filelist[0][:self.filelist[0].rfind('.')] +
                "_profile.ini")
        center = profile.getMachineCenterCoords() + profile.getObjectMatrix()
        outputFilename = sliceRun.getExportFilename(self.filelist[0])

        if profile.getPreference('filename_prompt') == 'True' or (
                os.path.exists(outputFilename)
                and profile.getPreference('file_overwrite_prompt') == 'True'):
            style = wx.FD_SAVE
            if profile.getPreference('file_overwrite_prompt') == 'True':
                style = style | wx.FD_OVERWRITE_PROMPT
            dlg = wx.FileDialog(self,
                                "Select gcode file to save",
                                os.path.split(outputFilename)[0],
                                os.path.split(outputFilename)[1],
                                style=style)
            dlg.SetWildcard("gcode files (*.gcode, *.g)|*.gcode;*.g")
            if dlg.ShowModal() != wx.ID_OK:
                dlg.Destroy()
                self.abort = True
                self.statusText.SetLabel("Aborted by user.")
                return
            outputFilename = dlg.GetPath()
            dlg.Destroy()

        cmdList = [
            sliceRun.getSliceCommand(outputFilename, ['|'.join(self.filelist)],
                                     [center])
        ]
        self.thread = WorkerThread(self, filelist, cmdList)
Beispiel #3
0
 def updateProfileToControls(self):
     self.matrix = numpy.matrix(
         numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((
             3,
             3,
         )))
     self.updateModelTransform()
     for obj in self.objectList:
         obj.steepDirty = True
     self.glCanvas.updateProfileToControls()
Beispiel #4
0
    def __init__(self, mainWindow, parent, filelist):
        wx.Panel.__init__(self, parent, -1)
        self.mainWindow = mainWindow
        self.filelist = filelist
        self.abort = False

        box = wx.StaticBox(self, -1, filelist[0])
        self.sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.sizer, 0, flag=wx.EXPAND)

        self.statusText = wx.StaticText(self, -1, "Starting...")
        self.progressGauge = wx.Gauge(self, -1)
        self.progressGauge.SetRange(10000 * len(filelist))
        self.abortButton = wx.Button(self, -1, "X", style=wx.BU_EXACTFIT)
        self.sizer.Add(self.statusText, 2, flag=wx.ALIGN_CENTER)
        self.sizer.Add(self.progressGauge, 2)
        self.sizer.Add(self.abortButton, 0)

        self.Bind(wx.EVT_BUTTON, self.OnAbort, self.abortButton)

        self.SetSizer(mainSizer)
        self.prevStep = "start"
        self.totalDoneFactor = 0.0
        self.startTime = time.time()
        if profile.getPreference("save_profile") == "True":
            profile.saveGlobalProfile(self.filelist[0][: self.filelist[0].rfind(".")] + "_profile.ini")
        center = profile.getMachineCenterCoords() + profile.getObjectMatrix()
        outputFilename = sliceRun.getExportFilename(self.filelist[0])

        if profile.getPreference("filename_prompt") == "True" or (
            os.path.exists(outputFilename) and profile.getPreference("file_overwrite_prompt") == "True"
        ):
            style = wx.FD_SAVE
            if profile.getPreference("file_overwrite_prompt") == "True":
                style = style | wx.FD_OVERWRITE_PROMPT
            dlg = wx.FileDialog(
                self,
                "Select gcode file to save",
                os.path.split(outputFilename)[0],
                os.path.split(outputFilename)[1],
                style=style,
            )
            dlg.SetWildcard("gcode files (*.gcode, *.g)|*.gcode;*.g")
            if dlg.ShowModal() != wx.ID_OK:
                dlg.Destroy()
                self.abort = True
                self.statusText.SetLabel("Aborted by user.")
                return
            outputFilename = dlg.GetPath()
            dlg.Destroy()

        cmdList = [sliceRun.getSliceCommand(outputFilename, ["|".join(self.filelist)], [center])]
        self.thread = WorkerThread(self, filelist, cmdList)
Beispiel #5
0
	def OnSlice(self, e):
		sliceCmdList = []
		outputFilenameList = []
		center = profile.getMachineCenterCoords() + profile.getObjectMatrix()
		for filename in self.list:
			outputFilename = sliceRun.getExportFilename(filename)
			outputFilenameList.append(outputFilename)
			sliceCmdList.append(sliceRun.getSliceCommand(outputFilename, [filename], [center]))
		bspw = BatchSliceProgressWindow(self.list[:], outputFilenameList, sliceCmdList)
		bspw.Centre()
		bspw.Show(True)
Beispiel #6
0
    def __init__(self, mainWindow, parent, filelist):
        wx.Panel.__init__(self, parent, -1)
        self.mainWindow = mainWindow
        self.filelist = filelist
        self.abort = False

        box = wx.StaticBox(self, -1, filelist[0])
        self.sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.sizer, 0, flag=wx.EXPAND)

        self.statusText = wx.StaticText(self, -1, "Starting...")
        self.progressGauge = wx.Gauge(self, -1)
        self.progressGauge.SetRange(10000 * len(filelist))
        self.abortButton = wx.Button(self, -1, "X", style=wx.BU_EXACTFIT)
        self.sizer.Add(self.statusText, 2, flag=wx.ALIGN_CENTER)
        self.sizer.Add(self.progressGauge, 2)
        self.sizer.Add(self.abortButton, 0)

        self.Bind(wx.EVT_BUTTON, self.OnAbort, self.abortButton)

        self.SetSizer(mainSizer)
        self.prevStep = 'start'
        self.totalDoneFactor = 0.0
        self.startTime = time.time()
        if profile.getPreference('save_profile') == 'True':
            profile.saveGlobalProfile(
                self.filelist[0][:self.filelist[0].rfind('.')] +
                "_profile.ini")
        center = profile.getMachineCenterCoords() + profile.getObjectMatrix()
        cmdList = [
            sliceRun.getSliceCommand(
                sliceRun.getExportFilename(self.filelist[0]),
                ['|'.join(self.filelist)], [center])
        ]
        self.thread = WorkerThread(self, filelist, cmdList)
Beispiel #7
0
	def updateProfileToControls(self):
		self.matrix = numpy.matrix(numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((3,3,)))
		self.updateModelTransform()
		for obj in self.objectList:
			obj.steepDirty = True
		self.glCanvas.updateProfileToControls()
Beispiel #8
0
	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.objectsBoundaryCircleSize = None
		self.loadThread = None
		self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height'))
		self.machineCenter = util3d.Vector3(self.machineSize.x / 2, self.machineSize.y / 2, 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.OnWarningPopup, 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)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		sizer.Add(self.glCanvas, 1, flag=wx.EXPAND)
		self.SetSizer(sizer)
		
		self.checkReloadFileTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnCheckReloadFile, self.checkReloadFileTimer)
		self.checkReloadFileTimer.Start(1000)

		group = []
		self.rotateToolButton = openglGui.glRadioButton(self.glCanvas, 1, 'Rotate', (0,-1), group, self.OnToolSelect)
		self.scaleToolButton  = openglGui.glRadioButton(self.glCanvas, 2, 'Scale', (1,-1), group, self.OnToolSelect)
		self.mirrorToolButton  = openglGui.glRadioButton(self.glCanvas, 12, 'Mirror', (2,-1), group, self.OnToolSelect)

		self.resetRotationButton = openglGui.glButton(self.glCanvas, 4, 'Reset rotation', (0,-2), self.OnRotateReset)
		self.layFlatButton       = openglGui.glButton(self.glCanvas, 5, 'Lay flat', (0,-3), self.OnLayFlat)

		self.resetScaleButton    = openglGui.glButton(self.glCanvas, 8, 'Scale reset', (1,-2), self.OnScaleReset)
		self.scaleMaxButton      = openglGui.glButton(self.glCanvas, 9, 'Scale to machine size', (1,-3), self.OnScaleMax)

		self.mirrorXButton       = openglGui.glButton(self.glCanvas, 12, 'Mirror X', (2,-2), lambda : self.OnMirror(0))
		self.mirrorYButton       = openglGui.glButton(self.glCanvas, 13, 'Mirror Y', (2,-3), lambda : self.OnMirror(1))
		self.mirrorZButton       = openglGui.glButton(self.glCanvas, 14, 'Mirror Z', (2,-4), lambda : self.OnMirror(2))

		self.openFileButton      = openglGui.glButton(self.glCanvas, 3, 'Load model', (0,0), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(1))
		self.sliceButton         = openglGui.glButton(self.glCanvas, 6, 'Prepare model', (1,0), lambda : self.GetParent().GetParent().GetParent().OnSlice(None))
		self.printButton         = openglGui.glButton(self.glCanvas, 7, 'Print model', (2,0), lambda : self.GetParent().GetParent().GetParent().OnPrint(None))

		extruderCount = int(profile.getPreference('extruder_amount'))
		if extruderCount > 1:
			openglGui.glButton(self.glCanvas, 3, 'Load dual model', (0,1), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(2))
		if extruderCount > 2:
			openglGui.glButton(self.glCanvas, 3, 'Load triple model', (0,2), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(3))
		if extruderCount > 3:
			openglGui.glButton(self.glCanvas, 3, 'Load quad model', (0,3), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(4))

		self.scaleForm = openglGui.glFrame(self.glCanvas, (2, -3))
		openglGui.glGuiLayoutGrid(self.scaleForm)
		openglGui.glLabel(self.scaleForm, 'Scale X', (0,0))
		self.scaleXctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,0), lambda value: self.OnScaleEntry(value, 0))
		openglGui.glLabel(self.scaleForm, 'Scale Y', (0,1))
		self.scaleYctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,1), lambda value: self.OnScaleEntry(value, 1))
		openglGui.glLabel(self.scaleForm, 'Scale Z', (0,2))
		self.scaleZctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,2), lambda value: self.OnScaleEntry(value, 2))
		openglGui.glLabel(self.scaleForm, 'Size X (mm)', (0,4))
		self.scaleXmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,4), lambda value: self.OnScaleEntryMM(value, 0))
		openglGui.glLabel(self.scaleForm, 'Size Y (mm)', (0,5))
		self.scaleYmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,5), lambda value: self.OnScaleEntryMM(value, 1))
		openglGui.glLabel(self.scaleForm, 'Size Z (mm)', (0,6))
		self.scaleZmmctrl = openglGui.glNumberCtrl(self.scaleForm, '0.0', (1,6), lambda value: self.OnScaleEntryMM(value, 2))
		openglGui.glLabel(self.scaleForm, 'Uniform scale', (0,8))
		self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1,8), None)

		self.viewSelection = openglGui.glComboButton(self.glCanvas, 'View mode', [0,1,2,3,4], ['3D Model', 'Transparent', 'X-Ray', 'Overhang', 'Layers'], (-1,0), self.OnViewChange)
		self.layerSelect = openglGui.glSlider(self.glCanvas, 0, 0, 100, (-1,-2), self.OnLayerNrChange)

		self.OnViewChange()
		self.OnToolSelect()
		self.returnToModelViewAndUpdateModel()

		self.matrix = numpy.matrix(numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((3,3,)))
Beispiel #9
0
	def updateProfileToControls(self):
		self.matrix = numpy.matrix(numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((3,3,)))
		self.updateModelTransform()
		self.glCanvas.updateProfileToControls()
Beispiel #10
0
	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.objectsBoundaryCircleSize = None
		self.loadThread = None
		self.machineSize = util3d.Vector3(profile.getPreferenceFloat('machine_width'), profile.getPreferenceFloat('machine_depth'), profile.getPreferenceFloat('machine_height'))
		self.machineCenter = util3d.Vector3(self.machineSize.x / 2, self.machineSize.y / 2, 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.OnWarningPopup, 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.showSteepOverhang = toolbarUtil.ToggleButton(self.toolbar, '', 'steepOverhang-on.png', 'steepOverhang-off.png', 'Show steep overhang', 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)

		group = []
		self.infoToolButton = toolbarUtil.RadioButton(self.toolbar2, group, 'info-on.png', 'info-off.png', 'Object info', callback=self.OnToolChange)
		self.rotateToolButton = toolbarUtil.RadioButton(self.toolbar2, group, 'object-rotate.png', 'object-rotate.png', 'Rotate object', callback=self.OnToolChange)
		self.scaleToolButton = toolbarUtil.RadioButton(self.toolbar2, group, 'object-scale.png', 'object-scale.png', 'Scale object', callback=self.OnToolChange)
		#self.mirrorToolButton = toolbarUtil.RadioButton(self.toolbar2, group, 'object-mirror-x-on.png', 'object-mirror-x-off.png', 'Mirror object', callback=self.OnToolChange)
		self.toolbar2.AddSeparator()
		# Mirror

		# Scale
		self.scaleMax = toolbarUtil.NormalButton(self.toolbar2, self.OnScaleMax, 'object-max-size.png', 'Scale object to fit machine size')

		self.toolbar2.AddSeparator()

		# Rotate
		self.rotateReset = toolbarUtil.NormalButton(self.toolbar2, self.OnRotateReset, 'object-rotate.png', 'Reset model rotation')
		self.layFlat = toolbarUtil.NormalButton(self.toolbar2, self.OnLayFlat, 'object-rotate.png', 'Lay flat')

		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)
		sizer.Add(self.glCanvas, 1, flag=wx.EXPAND)
		sizer.Add(self.toolbar2, 0, flag=wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=1)
		self.SetSizer(sizer)
		
		self.checkReloadFileTimer = wx.Timer(self)
		self.Bind(wx.EVT_TIMER, self.OnCheckReloadFile, self.checkReloadFileTimer)
		self.checkReloadFileTimer.Start(1000)

		self.matrix = numpy.matrix(numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((3,3,)))
		self.tool = toolInfo(self.glCanvas)
Beispiel #11
0
    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.objectsBoundaryCircleSize = None
        self.loadThread = None
        self.machineSize = util3d.Vector3(
            profile.getPreferenceFloat("machine_width"),
            profile.getPreferenceFloat("machine_depth"),
            profile.getPreferenceFloat("machine_height"),
        )
        self.machineCenter = util3d.Vector3(self.machineSize.x / 2, self.machineSize.y / 2, 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.OnWarningPopup, 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.showSteepOverhang = toolbarUtil.ToggleButton(
            self.toolbar,
            "",
            "steepOverhang-on.png",
            "steepOverhang-off.png",
            "Show steep overhang",
            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)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.toolbar, 0, flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=1)
        sizer.Add(self.glCanvas, 1, flag=wx.EXPAND)
        self.SetSizer(sizer)

        self.checkReloadFileTimer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnCheckReloadFile, self.checkReloadFileTimer)
        self.checkReloadFileTimer.Start(1000)

        group = []
        self.rotateToolButton = openglGui.glRadioButton(self.glCanvas, 1, "Rotate", (0, 1), group, self.OnToolSelect)
        self.scaleToolButton = openglGui.glRadioButton(self.glCanvas, 2, "Scale", (0, 2), group, self.OnToolSelect)
        self.mirrorToolButton = openglGui.glRadioButton(self.glCanvas, 12, "Mirror", (0, 3), group, self.OnToolSelect)

        self.resetRotationButton = openglGui.glButton(self.glCanvas, 4, "Reset rotation", (1, 1), self.OnRotateReset)
        self.layFlatButton = openglGui.glButton(self.glCanvas, 5, "Lay flat", (1, 2), self.OnLayFlat)

        self.resetScaleButton = openglGui.glButton(self.glCanvas, 8, "Scale reset", (1, 1), self.OnScaleReset)
        self.scaleMaxButton = openglGui.glButton(self.glCanvas, 9, "Scale to machine size", (1, 2), self.OnScaleMax)

        self.mirrorXButton = openglGui.glButton(self.glCanvas, 12, "Mirror X", (1, 1), lambda: self.OnMirror(0))
        self.mirrorYButton = openglGui.glButton(self.glCanvas, 13, "Mirror Y", (1, 2), lambda: self.OnMirror(1))
        self.mirrorZButton = openglGui.glButton(self.glCanvas, 14, "Mirror Z", (1, 3), lambda: self.OnMirror(2))

        self.openFileButton = openglGui.glButton(
            self.glCanvas,
            3,
            "Load model",
            (0, 0),
            lambda: self.GetParent().GetParent().GetParent()._showModelLoadDialog(1),
        )
        self.sliceButton = openglGui.glButton(
            self.glCanvas, 6, "Prepare model", (0, -2), lambda: self.GetParent().GetParent().GetParent().OnSlice(None)
        )
        self.printButton = openglGui.glButton(
            self.glCanvas, 7, "Print model", (0, -1), lambda: self.GetParent().GetParent().GetParent().OnPrint(None)
        )

        extruderCount = int(profile.getPreference("extruder_amount"))
        if extruderCount > 1:
            openglGui.glButton(
                self.glCanvas,
                3,
                "Load dual model",
                (1, 0),
                lambda: self.GetParent().GetParent().GetParent()._showModelLoadDialog(2),
            )
        if extruderCount > 2:
            openglGui.glButton(
                self.glCanvas,
                3,
                "Load triple model",
                (2, 0),
                lambda: self.GetParent().GetParent().GetParent()._showModelLoadDialog(3),
            )
        if extruderCount > 3:
            openglGui.glButton(
                self.glCanvas,
                3,
                "Load quad model",
                (3, 0),
                lambda: self.GetParent().GetParent().GetParent()._showModelLoadDialog(4),
            )

        self.scaleForm = openglGui.glFrame(self.glCanvas, (1, 3))
        openglGui.glGuiLayoutGrid(self.scaleForm)
        openglGui.glLabel(self.scaleForm, "Scale X", (0, 0))
        self.scaleXctrl = openglGui.glNumberCtrl(
            self.scaleForm, "1.0", (1, 0), lambda value: self.OnScaleEntry(value, 0)
        )
        openglGui.glLabel(self.scaleForm, "Scale Y", (0, 1))
        self.scaleYctrl = openglGui.glNumberCtrl(
            self.scaleForm, "1.0", (1, 1), lambda value: self.OnScaleEntry(value, 1)
        )
        openglGui.glLabel(self.scaleForm, "Scale Z", (0, 2))
        self.scaleZctrl = openglGui.glNumberCtrl(
            self.scaleForm, "1.0", (1, 2), lambda value: self.OnScaleEntry(value, 2)
        )
        openglGui.glLabel(self.scaleForm, "Size X (mm)", (0, 4))
        self.scaleXmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, "0.0", (1, 4), lambda value: self.OnScaleEntryMM(value, 0)
        )
        openglGui.glLabel(self.scaleForm, "Size Y (mm)", (0, 5))
        self.scaleYmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, "0.0", (1, 5), lambda value: self.OnScaleEntryMM(value, 1)
        )
        openglGui.glLabel(self.scaleForm, "Size Z (mm)", (0, 6))
        self.scaleZmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, "0.0", (1, 6), lambda value: self.OnScaleEntryMM(value, 2)
        )
        openglGui.glLabel(self.scaleForm, "Uniform scale", (0, 8))
        self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1, 8), None)

        self.OnViewChange()
        self.OnToolSelect()
        self.returnToModelViewAndUpdateModel()

        self.matrix = numpy.matrix(numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((3, 3)))
Beispiel #12
0
    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.objectsBoundaryCircleSize = None
        self.loadThread = None
        self.machineSize = util3d.Vector3(
            profile.getPreferenceFloat('machine_width'),
            profile.getPreferenceFloat('machine_depth'),
            profile.getPreferenceFloat('machine_height'))
        self.machineCenter = util3d.Vector3(self.machineSize.x / 2,
                                            self.machineSize.y / 2, 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.OnWarningPopup,
                  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)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.glCanvas, 1, flag=wx.EXPAND)
        self.SetSizer(sizer)

        self.checkReloadFileTimer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnCheckReloadFile,
                  self.checkReloadFileTimer)
        self.checkReloadFileTimer.Start(1000)

        group = []
        self.rotateToolButton = openglGui.glRadioButton(
            self.glCanvas, 8, 'Rotate', (0, -1), group, self.OnToolSelect)
        self.scaleToolButton = openglGui.glRadioButton(self.glCanvas, 9,
                                                       'Scale', (1, -1), group,
                                                       self.OnToolSelect)
        self.mirrorToolButton = openglGui.glRadioButton(
            self.glCanvas, 10, 'Mirror', (2, -1), group, self.OnToolSelect)

        self.resetRotationButton = openglGui.glButton(self.glCanvas, 12,
                                                      'Reset', (0, -2),
                                                      self.OnRotateReset)
        self.layFlatButton = openglGui.glButton(self.glCanvas, 16, 'Lay flat',
                                                (0, -3), self.OnLayFlat)

        self.resetScaleButton = openglGui.glButton(self.glCanvas, 13, 'Reset',
                                                   (1, -2), self.OnScaleReset)
        self.scaleMaxButton = openglGui.glButton(self.glCanvas, 17, 'To max',
                                                 (1, -3), self.OnScaleMax)

        self.mirrorXButton = openglGui.glButton(self.glCanvas, 14, 'Mirror X',
                                                (2, -2),
                                                lambda: self.OnMirror(0))
        self.mirrorYButton = openglGui.glButton(self.glCanvas, 18, 'Mirror Y',
                                                (2, -3),
                                                lambda: self.OnMirror(1))
        self.mirrorZButton = openglGui.glButton(self.glCanvas, 22, 'Mirror Z',
                                                (2, -4),
                                                lambda: self.OnMirror(2))

        self.openFileButton = openglGui.glButton(
            self.glCanvas,
            4, 'Load', (0, 0), lambda: self.GetParent().GetParent().GetParent(
            )._showModelLoadDialog(1))
        self.sliceButton = openglGui.glButton(
            self.glCanvas, 5, 'Prepare', (1, 0),
            lambda: self.GetParent().GetParent().GetParent().OnSlice(None))
        self.printButton = openglGui.glButton(
            self.glCanvas, 6, 'Print', (2, 0),
            lambda: self.GetParent().GetParent().GetParent().OnPrint(None))

        self.rotateToolButton.setExpandArrow(True)
        self.scaleToolButton.setExpandArrow(True)
        self.mirrorToolButton.setExpandArrow(True)

        extruderCount = int(profile.getPreference('extruder_amount'))
        if extruderCount > 1:
            openglGui.glButton(
                self.glCanvas, 4, 'Load dual', (0, 1), lambda: self.GetParent(
                ).GetParent().GetParent()._showModelLoadDialog(2))
        if extruderCount > 2:
            openglGui.glButton(
                self.glCanvas, 4, 'Load triple', (0, 2), lambda: self.
                GetParent().GetParent().GetParent()._showModelLoadDialog(3))
        if extruderCount > 3:
            openglGui.glButton(
                self.glCanvas, 4, 'Load quad', (0, 3), lambda: self.GetParent(
                ).GetParent().GetParent()._showModelLoadDialog(4))

        self.scaleForm = openglGui.glFrame(self.glCanvas, (2, -2))
        openglGui.glGuiLayoutGrid(self.scaleForm)
        openglGui.glLabel(self.scaleForm, 'Scale X', (0, 0))
        self.scaleXctrl = openglGui.glNumberCtrl(
            self.scaleForm, '1.0', (1, 0),
            lambda value: self.OnScaleEntry(value, 0))
        openglGui.glLabel(self.scaleForm, 'Scale Y', (0, 1))
        self.scaleYctrl = openglGui.glNumberCtrl(
            self.scaleForm, '1.0', (1, 1),
            lambda value: self.OnScaleEntry(value, 1))
        openglGui.glLabel(self.scaleForm, 'Scale Z', (0, 2))
        self.scaleZctrl = openglGui.glNumberCtrl(
            self.scaleForm, '1.0', (1, 2),
            lambda value: self.OnScaleEntry(value, 2))
        openglGui.glLabel(self.scaleForm, 'Size X (mm)', (0, 4))
        self.scaleXmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, '0.0', (1, 4),
            lambda value: self.OnScaleEntryMM(value, 0))
        openglGui.glLabel(self.scaleForm, 'Size Y (mm)', (0, 5))
        self.scaleYmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, '0.0', (1, 5),
            lambda value: self.OnScaleEntryMM(value, 1))
        openglGui.glLabel(self.scaleForm, 'Size Z (mm)', (0, 6))
        self.scaleZmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, '0.0', (1, 6),
            lambda value: self.OnScaleEntryMM(value, 2))
        openglGui.glLabel(self.scaleForm, 'Uniform scale', (0, 8))
        self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1, 8),
                                                 None)

        self.viewSelection = openglGui.glComboButton(
            self.glCanvas, 'View mode', [7, 11, 15, 19, 23],
            ['Normal', 'Transparent', 'X-Ray', 'Overhang', 'Layers'], (-1, 0),
            self.OnViewChange)
        self.layerSelect = openglGui.glSlider(self.glCanvas, 0, 0, 100,
                                              (-1, -2), lambda: self.Refresh())

        self.OnViewChange()
        self.OnToolSelect()
        self.updateModelTransform()

        self.matrix = numpy.matrix(
            numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((
                3,
                3,
            )))
Beispiel #13
0
    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.objectsBoundaryCircleSize = None
        self.loadThread = None
        self.machineSize = util3d.Vector3(
            profile.getPreferenceFloat('machine_width'),
            profile.getPreferenceFloat('machine_depth'),
            profile.getPreferenceFloat('machine_height'))
        self.machineCenter = util3d.Vector3(self.machineSize.x / 2,
                                            self.machineSize.y / 2, 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.OnWarningPopup,
                  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.showSteepOverhang = toolbarUtil.ToggleButton(
            self.toolbar,
            '',
            'steepOverhang-on.png',
            'steepOverhang-off.png',
            'Show steep overhang',
            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)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.toolbar,
                  0,
                  flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
                  border=1)
        sizer.Add(self.glCanvas, 1, flag=wx.EXPAND)
        self.SetSizer(sizer)

        self.checkReloadFileTimer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnCheckReloadFile,
                  self.checkReloadFileTimer)
        self.checkReloadFileTimer.Start(1000)

        group = []
        self.rotateToolButton = openglGui.glRadioButton(
            self.glCanvas, 1, 'Rotate', (0, 1), group, self.OnToolSelect)
        self.scaleToolButton = openglGui.glRadioButton(self.glCanvas, 2,
                                                       'Scale', (0, 2), group,
                                                       self.OnToolSelect)
        self.mirrorToolButton = openglGui.glRadioButton(
            self.glCanvas, 12, 'Mirror', (0, 3), group, self.OnToolSelect)

        self.resetRotationButton = openglGui.glButton(self.glCanvas, 4,
                                                      'Reset rotation', (1, 1),
                                                      self.OnRotateReset)
        self.layFlatButton = openglGui.glButton(self.glCanvas, 5, 'Lay flat',
                                                (1, 2), self.OnLayFlat)

        self.resetScaleButton = openglGui.glButton(self.glCanvas, 8,
                                                   'Scale reset', (1, 1),
                                                   self.OnScaleReset)
        self.scaleMaxButton = openglGui.glButton(self.glCanvas, 9,
                                                 'Scale to machine size',
                                                 (1, 2), self.OnScaleMax)

        self.mirrorXButton = openglGui.glButton(self.glCanvas, 12, 'Mirror X',
                                                (1, 1),
                                                lambda: self.OnMirror(0))
        self.mirrorYButton = openglGui.glButton(self.glCanvas, 13, 'Mirror Y',
                                                (1, 2),
                                                lambda: self.OnMirror(1))
        self.mirrorZButton = openglGui.glButton(self.glCanvas, 14, 'Mirror Z',
                                                (1, 3),
                                                lambda: self.OnMirror(2))

        self.openFileButton = openglGui.glButton(
            self.glCanvas, 3, 'Load model', (0, 0), lambda: self.GetParent().
            GetParent().GetParent()._showModelLoadDialog(1))
        self.sliceButton = openglGui.glButton(
            self.glCanvas, 6, 'Prepare model', (0, -2),
            lambda: self.GetParent().GetParent().GetParent().OnSlice(None))
        self.printButton = openglGui.glButton(
            self.glCanvas, 7, 'Print model', (0, -1),
            lambda: self.GetParent().GetParent().GetParent().OnPrint(None))

        extruderCount = int(profile.getPreference('extruder_amount'))
        if extruderCount > 1:
            openglGui.glButton(
                self.glCanvas, 3,
                'Load dual model', (1, 0), lambda: self.GetParent().GetParent(
                ).GetParent()._showModelLoadDialog(2))
        if extruderCount > 2:
            openglGui.glButton(
                self.glCanvas, 3, 'Load triple model', (2, 0), lambda: self.
                GetParent().GetParent().GetParent()._showModelLoadDialog(3))
        if extruderCount > 3:
            openglGui.glButton(
                self.glCanvas, 3,
                'Load quad model', (3, 0), lambda: self.GetParent().GetParent(
                ).GetParent()._showModelLoadDialog(4))

        self.scaleForm = openglGui.glFrame(self.glCanvas, (1, 3))
        openglGui.glGuiLayoutGrid(self.scaleForm)
        openglGui.glLabel(self.scaleForm, 'Scale X', (0, 0))
        self.scaleXctrl = openglGui.glNumberCtrl(
            self.scaleForm, '1.0', (1, 0),
            lambda value: self.OnScaleEntry(value, 0))
        openglGui.glLabel(self.scaleForm, 'Scale Y', (0, 1))
        self.scaleYctrl = openglGui.glNumberCtrl(
            self.scaleForm, '1.0', (1, 1),
            lambda value: self.OnScaleEntry(value, 1))
        openglGui.glLabel(self.scaleForm, 'Scale Z', (0, 2))
        self.scaleZctrl = openglGui.glNumberCtrl(
            self.scaleForm, '1.0', (1, 2),
            lambda value: self.OnScaleEntry(value, 2))
        openglGui.glLabel(self.scaleForm, 'Size X (mm)', (0, 4))
        self.scaleXmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, '0.0', (1, 4),
            lambda value: self.OnScaleEntryMM(value, 0))
        openglGui.glLabel(self.scaleForm, 'Size Y (mm)', (0, 5))
        self.scaleYmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, '0.0', (1, 5),
            lambda value: self.OnScaleEntryMM(value, 1))
        openglGui.glLabel(self.scaleForm, 'Size Z (mm)', (0, 6))
        self.scaleZmmctrl = openglGui.glNumberCtrl(
            self.scaleForm, '0.0', (1, 6),
            lambda value: self.OnScaleEntryMM(value, 2))
        openglGui.glLabel(self.scaleForm, 'Uniform scale', (0, 8))
        self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1, 8),
                                                 None)

        self.OnViewChange()
        self.OnToolSelect()
        self.returnToModelViewAndUpdateModel()

        self.matrix = numpy.matrix(
            numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((
                3,
                3,
            )))