Ejemplo n.º 1
0
    def OnLoadProfileFromGcode(self, e):
        dlg = wx.FileDialog(self,
                            _("Select gcode file to load profile from"),
                            os.path.split(
                                profile.getPreference('lastFile'))[0],
                            style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
        dlg.SetWildcard(
            "gcode files (*%s)|*%s;*%s" %
            (profile.getGCodeExtension(), profile.getGCodeExtension(),
             profile.getGCodeExtension()[0:2]))
        if dlg.ShowModal() == wx.ID_OK:
            gcodeFile = dlg.GetPath()
            f = open(gcodeFile, 'r')
            hasProfile = False
            for line in f:
                if line.startswith(';CURA_PROFILE_STRING:'):
                    profile.setProfileFromString(line[line.find(':') +
                                                      1:].strip())

                    if ';{profile_string}' not in profile.getAlterationFile(
                            'end.gcode'):
                        profile.setAlterationFile(
                            'end.gcode',
                            profile.getAlterationFile('end.gcode') +
                            '\n;{profile_string}')
                    hasProfile = True
            if hasProfile:
                self.updateProfileToAllControls()
            else:
                wx.MessageBox(
                    _("No profile found in GCode file.\nThis feature only works with GCode files made by Cura 12.07 or newer."
                      ), _("Profile load error"), wx.OK | wx.ICON_INFORMATION)
        dlg.Destroy()
Ejemplo n.º 2
0
	def OnRefresh(self, e):
		if self.selected != None:	
			profile.setAlterationFile(self.selected, self.textArea.GetValue())		
		try:
			self.GetParent().GetParent().GetParent().GetParent().GetParent().scene.sceneUpdated()
		except Exception as e:
			raise e		
Ejemplo n.º 3
0
 def OnLoadProfileFromGcode(self, e):
     dlg = wx.FileDialog(
         self,
         _("Select gcode file to load profile from"),
         os.path.split(profile.getPreference("lastFile"))[0],
         style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST,
     )
     dlg.SetWildcard(
         "gcode files (*%s)|*%s;*%s"
         % (profile.getGCodeExtension(), profile.getGCodeExtension(), profile.getGCodeExtension()[0:2])
     )
     if dlg.ShowModal() == wx.ID_OK:
         gcodeFile = dlg.GetPath()
         f = open(gcodeFile, "r")
         hasProfile = False
         for line in f:
             if line.startswith(";CURA_PROFILE_STRING:"):
                 profile.setProfileFromString(line[line.find(":") + 1 :].strip())
                 if ";{profile_string}" not in profile.getAlterationFile("end.gcode"):
                     profile.setAlterationFile(
                         "end.gcode", profile.getAlterationFile("end.gcode") + "\n;{profile_string}"
                     )
                 hasProfile = True
         if hasProfile:
             self.updateProfileToAllControls()
         else:
             wx.MessageBox(
                 _(
                     "No profile found in GCode file.\nThis feature only works with GCode files made by Cura 12.07 or newer."
                 ),
                 _("Profile load error"),
                 wx.OK | wx.ICON_INFORMATION,
             )
     dlg.Destroy()
Ejemplo n.º 4
0
	def OnNormalSwitch(self, e):
		profile.putPreference('startMode', 'Normal')
		dlg = wx.MessageDialog(self, _("Copy the settings from quickprint to your full settings?\n(This will overwrite any full setting modifications you have)"), _("Profile copy"), wx.YES_NO | wx.ICON_QUESTION)
		result = dlg.ShowModal() == wx.ID_YES
		dlg.Destroy()
		if result:
			profile.resetProfile()
			for k, v in self.simpleSettingsPanel.getSettingOverrides().items():
				if profile.isProfileSetting(k):
					profile.putProfileSetting(k, v)
				elif profile.isAlterationSetting(k):
					profile.setAlterationFile(k, v)
			self.updateProfileToAllControls()
		self.updateSliceMode()
Ejemplo n.º 5
0
	def OnNormalSwitch(self, e):
		profile.putPreference('startMode', 'Normal')
		dlg = wx.MessageDialog(self, _("Copy the settings from quickprint to your full settings?\n(This will overwrite any full setting modifications you have)"), _("Profile copy"), wx.YES_NO | wx.ICON_QUESTION)
		result = dlg.ShowModal() == wx.ID_YES
		dlg.Destroy()
		if result:
			profile.resetProfile()
			for k, v in self.simpleSettingsPanel.getSettingOverrides().items():
				if profile.isProfileSetting(k):
					profile.putProfileSetting(k, v)
				elif profile.isAlterationSetting(k):
					profile.setAlterationFile(k, v)
			self.updateProfileToAllControls()
		self.updateSliceMode()
Ejemplo n.º 6
0
 def OnFocusLost(self, e):
     if self.currentFile == self.list.GetSelection():
         profile.setAlterationFile(
             self.alterationFileList[self.list.GetSelection()],
             self.textArea.GetValue())
         self.callback()
Ejemplo n.º 7
0
	def OnFocusLost(self, e):
		if self.currentFile == self.list.GetSelection():
			profile.setAlterationFile(self.alterationFileList[self.list.GetSelection()], self.textArea.GetValue())
			self.callback()