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()
	def OnClose(self, e):
		profile.saveProfile(profile.getDefaultProfilePath(), True)

		# 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 can keep wxWidgets from quiting.
		print "Closing down"
		self.scene.OnPaint = lambda e : e
		self.scene._engine.cleanup()
		self.Destroy()
示例#3
0
文件: cura.py 项目: 3dUBU/CuraUBu
def main():
	parser = OptionParser(usage="usage: %prog [options] <filename>.stl")
	parser.add_option("-i", "--ini", action="store", type="string", dest="profileini",
		help="Load settings from a profile ini file")
	parser.add_option("-r", "--print", action="store", type="string", dest="printfile",
		help="Open the printing interface, instead of the normal cura interface.")
	parser.add_option("-p", "--profile", action="store", type="string", dest="profile",
		help="Internal option, do not use!")
	parser.add_option("-s", "--slice", action="store_true", dest="slice",
		help="Slice the given files instead of opening them in Cura")
	parser.add_option("-o", "--output", action="store", type="string", dest="output",
		help="path to write sliced file to")

	(options, args) = parser.parse_args()

	profile.loadPreferences(profile.getPreferencePath())
	if options.profile is not None:
		profile.setProfileFromString(options.profile)
	elif options.profileini is not None:
		profile.loadProfile(options.profileini)
	else:
		profile.loadProfile(profile.getDefaultProfilePath())

	if options.printfile is not None:
		from Cura.gui import printWindow
		printWindow.startPrintInterface(options.printfile)
	elif options.slice is not None:
		from Cura.util import sliceEngine
		from Cura.util import objectScene
		from Cura.util import meshLoader
		import shutil

		def commandlineProgressCallback(progress, ready):
			if progress >= 0 and not ready:
				print 'Preparing: %d%%' % (progress * 100)
		scene = objectScene.Scene()
		scene.updateMachineDimensions()
		slicer = sliceEngine.Slicer(commandlineProgressCallback)
		for m in meshLoader.loadMeshes(args[0]):
			scene.add(m)
		slicer.runSlicer(scene)
		slicer.wait()
		profile.replaceGCodeTagsFromSlicer(slicer.getGCodeFilename(), slicer)

		if options.output:
			shutil.copyfile(slicer.getGCodeFilename(), options.output)
			print 'GCode file saved : %s' % options.output
		else:
			shutil.copyfile(slicer.getGCodeFilename(), args[0] + '.gcode')
			print 'GCode file saved as: %s' % (args[0] + '.gcode')

		slicer.cleanup()
	else:
		from Cura.gui import app
		app.CuraApp(args).MainLoop()
示例#4
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()
示例#5
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()
示例#6
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()
示例#7
0
	def OnClose(self, e):
		profile.saveGlobalProfile(profile.getDefaultProfilePath())
		self.Destroy()
示例#8
0
def main():
    """
    Main Cura entry point. Parses arguments, and starts GUI or slicing process depending on the arguments.
    """
    parser = OptionParser(usage="usage: %prog [options] <filename>.stl")
    parser.add_option("-i", "--ini", action="store", type="string", dest="profileini",
        help="Load settings from a profile ini file")
    parser.add_option("-r", "--print", action="store", type="string", dest="printfile",
        help="Open the printing interface, instead of the normal cura interface.")
    parser.add_option("-p", "--profile", action="store", type="string", dest="profile",
        help="Internal option, do not use!")
    parser.add_option("-s", "--slice", action="store_true", dest="slice",
        help="Slice the given files instead of opening them in Cura")
    parser.add_option("-o", "--output", action="store", type="string", dest="output",
        help="path to write sliced file to")
    parser.add_option("--serialCommunication", action="store", type="string", dest="serialCommunication",
        help="Start commandline serial monitor")

    (options, args) = parser.parse_args()

    if options.serialCommunication:
        from Cura import serialCommunication
        port, baud = options.serialCommunication.split(':')
        serialCommunication.startMonitor(port, baud)
        return

    print "load preferences from " + profile.getPreferencePath()
    profile.loadPreferences(profile.getPreferencePath())

    if options.profile is not None:
        profile.setProfileFromString(options.profile)
    elif options.profileini is not None:
        profile.loadProfile(options.profileini)
    else:
        profile.loadProfile(profile.getDefaultProfilePath(), True)

    if options.printfile is not None:
        from Cura.gui import printWindow
        printWindow.startPrintInterface(options.printfile)
    elif options.slice is not None:
        from Cura.util import sliceEngine
        from Cura.util import objectScene
        from Cura.util import meshLoader
        import shutil

        def commandlineProgressCallback(progress):
            if progress >= 0:
                #print 'Preparing: %d%%' % (progress * 100)
                pass
        scene = objectScene.Scene()
        scene.updateMachineDimensions()
        engine = sliceEngine.Engine(commandlineProgressCallback)
        for m in meshLoader.loadMeshes(args[0]):
            scene.add(m)
        engine.runEngine(scene)
        engine.wait()

        if not options.output:
            options.output = args[0] + profile.getGCodeExtension()
        with open(options.output, "wb") as f:
            gcode = engine.getResult().getGCode()
            while True:
                data = gcode.read()
                if len(data) == 0:
                    break
                f.write(data)
        print 'GCode file saved : %s' % options.output

        engine.cleanup()
    else:
        from Cura.gui import app
        app.CuraApp(args).MainLoop()
示例#9
0
def main():
    parser = OptionParser(usage="usage: %prog [options] <filename>.stl")
    parser.add_option("-i",
                      "--ini",
                      action="store",
                      type="string",
                      dest="profileini",
                      help="Load settings from a profile ini file")
    parser.add_option(
        "-r",
        "--print",
        action="store",
        type="string",
        dest="printfile",
        help=
        "Open the printing interface, instead of the normal cura interface.")
    parser.add_option("-p",
                      "--profile",
                      action="store",
                      type="string",
                      dest="profile",
                      help="Internal option, do not use!")
    parser.add_option(
        "-s",
        "--slice",
        action="store_true",
        dest="slice",
        help="Slice the given files instead of opening them in Cura")
    parser.add_option("-o",
                      "--output",
                      action="store",
                      type="string",
                      dest="output",
                      help="path to write sliced file to")

    (options, args) = parser.parse_args()

    profile.loadPreferences(profile.getPreferencePath())
    if options.profile is not None:
        profile.setProfileFromString(options.profile)
    elif options.profileini is not None:
        profile.loadProfile(options.profileini)
    else:
        profile.loadProfile(profile.getDefaultProfilePath())

    if options.printfile is not None:
        from Cura.gui import printWindow
        printWindow.startPrintInterface(options.printfile)
    elif options.slice is not None:
        from Cura.util import sliceEngine
        from Cura.util import objectScene
        from Cura.util import meshLoader
        import shutil

        def commandlineProgessCallback(progress, ready):
            if progress >= 0 and not ready:
                print 'Preparing: %d%%' % (progress * 100)

        scene = objectScene.Scene()
        slicer = sliceEngine.Slicer(commandlineProgessCallback)
        for m in meshLoader.loadMeshes(args[0]):
            scene.add(m)
        slicer.runSlicer(scene)
        slicer.wait()

        if options.output:
            shutil.copyfile(slicer.getGCodeFilename(), options.output)
            print 'GCode file saved : %s' % options.output
        else:
            shutil.copyfile(slicer.getGCodeFilename(), args[0] + '.gcode')
            print 'GCode file saved as: %s' % (args[0] + '.gcode')

        slicer.cleanup()
    else:
        from Cura.gui import app
        app.CuraApp(args).MainLoop()
示例#10
0
def main():
    """
	Main Cura entry point. Parses arguments, and starts GUI or slicing process depending on the arguments.
	"""
    parser = OptionParser(usage="usage: %prog [options] <filename>.stl")
    parser.add_option("-i",
                      "--ini",
                      action="store",
                      type="string",
                      dest="profileini",
                      help="Load settings from a profile ini file")
    parser.add_option(
        "-r",
        "--print",
        action="store",
        type="string",
        dest="printfile",
        help=
        "Open the printing interface, instead of the normal cura interface.")
    parser.add_option("-p",
                      "--profile",
                      action="store",
                      type="string",
                      dest="profile",
                      help="Internal option, do not use!")
    parser.add_option(
        "-s",
        "--slice",
        action="store_true",
        dest="slice",
        help="Slice the given files instead of opening them in Cura")
    parser.add_option("-o",
                      "--output",
                      action="store",
                      type="string",
                      dest="output",
                      help="path to write sliced file to")
    parser.add_option("--serialCommunication",
                      action="store",
                      type="string",
                      dest="serialCommunication",
                      help="Start commandline serial monitor")

    (options, args) = parser.parse_args()

    if options.serialCommunication:
        from Cura import serialCommunication
        port, baud = options.serialCommunication.split(':')
        serialCommunication.startMonitor(port, baud)
        return

    print("load preferences from " + profile.getPreferencePath())
    profile.loadPreferences(profile.getPreferencePath())

    if options.profile is not None:
        profile.setProfileFromString(options.profile)
    elif options.profileini is not None:
        profile.loadProfile(options.profileini)
    else:
        profile.loadProfile(profile.getDefaultProfilePath(), True)

    if options.printfile is not None:
        from Cura.gui import printWindow
        printWindow.startPrintInterface(options.printfile)
    elif options.slice is not None:
        from Cura.util import sliceEngine
        from Cura.util import objectScene
        from Cura.util import meshLoader
        import shutil

        def commandlineProgressCallback(progress):
            if progress >= 0:
                #print 'Preparing: %d%%' % (progress * 100)
                pass

        scene = objectScene.Scene()
        scene.updateMachineDimensions()
        engine = sliceEngine.Engine(commandlineProgressCallback)
        for m in meshLoader.loadMeshes(args[0]):
            scene.add(m)
        engine.runEngine(scene)
        engine.wait()

        if not options.output:
            options.output = args[0] + profile.getGCodeExtension()
        with open(options.output, "wb") as f:
            gcode = engine.getResult().getGCode()
            while True:
                data = gcode.read()
                if len(data) == 0:
                    break
                f.write(data)
        print('GCode file saved : %s' % options.output)

        engine.cleanup()
    else:
        from Cura.gui import app
        app.CuraApp(args).MainLoop()
示例#11
0
	def __init__(self, parent, callback = None):
		super(normalSettingsPanel, self).__init__(parent, callback)

		self.parent = parent
		self.loadxml()
		self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Filament :"))
		self.label_4 = wx.StaticText(self, wx.ID_ANY, _("Température (°C) :".decode('utf-8')))
		self.spin_ctrl_1 = wx.SpinCtrl(self, wx.ID_ANY, "190", min=175, max=235, style=wx.SP_ARROW_KEYS | wx.TE_AUTO_URL)
		self.button_1 = wx.Button(self, wx.ID_ANY, _('Préparer l\'Impression'.decode('utf-8')))
		self.__set_properties()
		self.__do_layout()

		#Refresh ALL Value
		self.Refresh_Preci()
		self.Refresh_Fila()
		self.Refresh_Rempli()
		self.Refresh_Checkboxsupp()
		self.Refresh_Checkboxbrim()

		profile.saveProfile(profile.getDefaultProfilePath(), True)

		# Main tabs
		# self.nb = wx.Notebook(self)
		# self.SetSizer(wx.BoxSizer(wx.HORIZONTAL))
		# self.GetSizer().Add(self.nb, 1, wx.EXPAND)

		# (left, right, self.printPanel) = self.CreateDynamicConfigTab(self.nb, 'Basic')
		# self._addSettingsToPanels('basic', left, right)
		# self.SizeLabelWidths(left, right)

		# (left, right, self.advancedPanel) = self.CreateDynamicConfigTab(self.nb, 'Advanced')
		# self._addSettingsToPanels('advanced', left, right)
		# self.SizeLabelWidths(left, right)

		# #Plugin page
		# self.pluginPanel = pluginPanel.pluginPanel(self.nb, callback)
		# self.nb.AddPage(self.pluginPanel, _("Plugins"))
		# self.nb.Hide()

		#Alteration page
		# if profile.getMachineSetting('machine_name') == 'Discovery':
		# 	self.alterationPanel = alterationPanel.alterationPanel(self, callback)
		# if profile.getMachineSetting('gcode_flavor') == 'UltiGCode':
		# 	self.alterationPanel = None
		# else:
			# self.alterationPanel = alterationPanel.alterationPanel(self.nb, callback)
			# self.nb.AddPage(self.alterationPanel, "Start/End-GCode")


		#Evt Select Filament
		if sys.platform == 'darwin':
			self.Bind(wx.EVT_CHOICE, self.EVT_Fila, self.combo_box_1)
		else:
			self.Bind(wx.EVT_COMBOBOX, self.EVT_Fila, self.combo_box_1)
			self.Bind(wx.EVT_TEXT, self.EVT_Fila, self.combo_box_1)
			self.Bind(wx.EVT_TEXT_ENTER, self.EVT_Fila, self.combo_box_1)

		#Evt Select Précision
		self.Bind(wx.EVT_RADIOBOX, self.EVT_Preci, self.radio_box_1)

		#Evt Select Remplissage
		self.Bind(wx.EVT_RADIOBOX, self.EVT_Rempl, self.radio_box_2)

		#Evt CheckboxSupport
		self.Bind(wx.EVT_CHECKBOX, self.EVT_Checkboxsupp,self.printsupp)
		#Evt CheckboxBrim
		self.Bind(wx.EVT_CHECKBOX, self.EVT_Checkboxbrim,self.printbrim)

		#Evt Print Button
		self.Bind(wx.EVT_BUTTON, self.Click_Button, self.button_1)

 		self.Bind(wx.EVT_SIZE, self.OnSize)
示例#12
0
	def Click_Button(self, event):
		profile.putProfileSetting('print_temperature', str(self.spin_ctrl_1.GetValue() + self.temp_preci))
		self.Print_All()
		profile.saveProfile(profile.getDefaultProfilePath(), True)
		self.GetParent().GetParent().GetParent().scene.OnPrintButton(1)		
		event.Skip()
示例#13
0
	def EVT_Fila(self, event):
		self.Refresh_Fila()
		profile.saveProfile(profile.getDefaultProfilePath(), True)
		self.GetParent().GetParent().GetParent().scene.updateProfileToControls()
		self.GetParent().GetParent().GetParent().scene.sceneUpdated()
		event.Skip()