示例#1
0
	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()
示例#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()
		cmdList = [sliceRun.getSliceCommand(sliceRun.getExportFilename(self.filelist[0]), ['|'.join(self.filelist)], [center])]
		self.thread = WorkerThread(self, filelist, cmdList)
	def OnClose(self, e):
		profile.saveGlobalProfile(profile.getDefaultProfilePath())

		# Save the window position, size & state from the preferences file
		profile.putPreference('window_maximized', self.IsMaximized())
		if not self.IsMaximized() and not self.IsIconized():
			(posx, posy) = self.GetPosition()
			profile.putPreference('window_pos_x', posx)
			profile.putPreference('window_pos_y', posy)
			(width, height) = self.GetSize()
			profile.putPreference('window_width', width)
			profile.putPreference('window_height', height)

			# Save normal sash position.  If in normal mode (!simple mode), get last position of sash before saving it...
			isSimple = profile.getPreference('startMode') == 'Simple'
			if not isSimple:
				self.normalSashPos = self.splitter.GetSashPosition()
			profile.putPreference('window_normal_sash', self.normalSashPos)

		#HACK: Set the paint function of the glCanvas to nothing so it won't keep refreshing. Which keeps wxWidgets from quiting.
		print "Closing down"
		self.scene.OnPaint = lambda e : e
		#self.scene._slicer.cleanup()
		profile.putPreference('selectedFile', '')
		self.Destroy()
示例#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)
示例#5
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)
示例#6
0
 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()
示例#7
0
	def OnClose(self, e):
		profile.saveGlobalProfile(profile.getDefaultProfilePath())

		# Save the window position, size & state from the preferences file
		profile.putPreference('window_maximized', self.IsMaximized())
		if not self.IsMaximized() and not self.IsIconized():
			(posx, posy) = self.GetPosition()
			profile.putPreference('window_pos_x', posx)
			profile.putPreference('window_pos_y', posy)
			(width, height) = self.GetSize()
			profile.putPreference('window_width', width)
			profile.putPreference('window_height', height)
			
			# Save sash position
			self.windowSashPos = self.splitter.GetSashPosition()
			profile.putPreference('window_sash', self.windowSashPos)
			
		self.Destroy()
示例#8
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")
		cmdList = []
		for filename in self.filelist:
			idx = self.filelist.index(filename)
			#print filename, idx
			if idx > 0:
				profile.setTempOverride('fan_enabled', 'False')
				profile.setTempOverride('skirt_line_count', '0')
				profile.setTempOverride('object_center_x', profile.getPreferenceFloat('machine_width') / 2 - profile.getPreferenceFloat('extruder_offset_x%d' % (idx)))
				profile.setTempOverride('object_center_y', profile.getPreferenceFloat('machine_depth') / 2 - profile.getPreferenceFloat('extruder_offset_y%d' % (idx)))
				profile.setTempOverride('alternative_center', self.filelist[0])
			if len(self.filelist) > 1:
				profile.setTempOverride('add_start_end_gcode', 'False')
				profile.setTempOverride('gcode_extension', 'multi_extrude_tmp')
			cmdList.append(sliceRun.getSliceCommand(filename))
		profile.resetTempOverride()
		self.thread = WorkerThread(self, filelist, cmdList)
示例#9
0
文件: mainWindow.py 项目: cb0/Cura
	def OnClose(self, e):
		profile.saveGlobalProfile(profile.getDefaultProfilePath())

		# Save the window position, size & state from the preferences file
		profile.putPreference('window_maximized', self.IsMaximized())
		if not self.IsMaximized() and not self.IsIconized():
			(posx, posy) = self.GetPosition()
			profile.putPreference('window_pos_x', posx)
			profile.putPreference('window_pos_y', posy)
			(width, height) = self.GetSize()
			profile.putPreference('window_width', width)
			profile.putPreference('window_height', height)			
			
			# Save normal sash position.  If in normal mode (!simple mode), get last position of sash before saving it...
			isSimple = profile.getPreference('startMode') == 'Simple'
			if not isSimple:
				self.normalSashPos = self.splitter.GetSashPosition()
			profile.putPreference('window_normal_sash', self.normalSashPos)
			
		self.Destroy()
示例#10
0
    def OnClose(self, e):
        profile.saveGlobalProfile(profile.getDefaultProfilePath())

        # Save the window position, size & state from the preferences file
        profile.putPreference("window_maximized", self.IsMaximized())
        if not self.IsMaximized() and not self.IsIconized():
            (posx, posy) = self.GetPosition()
            profile.putPreference("window_pos_x", posx)
            profile.putPreference("window_pos_y", posy)
            (width, height) = self.GetSize()
            profile.putPreference("window_width", width)
            profile.putPreference("window_height", height)

            # Save normal sash position.  If in normal mode (!simple mode), get last position of sash before saving it...
            isSimple = profile.getPreference("startMode") == "Simple"
            if not isSimple:
                self.normalSashPos = self.splitter.GetSashPosition()
            profile.putPreference("window_normal_sash", self.normalSashPos)

            # HACK: Set the paint function of the glCanvas to nothing so it won't keep refreshing. Which keeps wxWidgets from quiting.
        self.preview3d.glCanvas.OnPaint = lambda e: e
        self.Destroy()
示例#11
0
    def OnClose(self, e):
        profile.saveGlobalProfile(profile.getDefaultProfilePath())

        # Save the window position, size & state from the preferences file
        profile.putPreference('window_maximized', self.IsMaximized())
        if not self.IsMaximized() and not self.IsIconized():
            (posx, posy) = self.GetPosition()
            profile.putPreference('window_pos_x', posx)
            profile.putPreference('window_pos_y', posy)
            (width, height) = self.GetSize()
            profile.putPreference('window_width', width)
            profile.putPreference('window_height', height)

            # Save normal sash position.  If in normal mode (!simple mode), get last position of sash before saving it...
            isSimple = profile.getPreference('startMode') == 'Simple'
            if not isSimple:
                self.normalSashPos = self.splitter.GetSashPosition()
            profile.putPreference('window_normal_sash', self.normalSashPos)

        #HACK: Set the paint function of the glCanvas to nothing so it won't keep refreshing. Which keeps wxWidgets from quiting.
        self.preview3d.glCanvas.OnPaint = lambda e: e
        self.Destroy()
示例#12
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)
示例#13
0
	def OnClose(self, e):
		profile.saveGlobalProfile(profile.getDefaultProfilePath())
		self.Destroy()