Пример #1
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()
Пример #2
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()
 def checkGCodePart(self, part, pos):
     if len(part) < 2:
         self.StartStyling(pos, 0x40)
         self.SetStyling(1, 0x40)
         return True
     if not part[0] in "GMXYZFESTBPIDCJ":
         self.StartStyling(pos, 0x40)
         self.SetStyling(1, 0x40)
         return True
     if part[1] == '{':
         if part[-1] != '}':
             return True
         tag = part[2:-1]
         if not profile.isProfileSetting(tag) and not profile.isPreference(
                 tag):
             self.StartStyling(pos + 2, 0x40)
             self.SetStyling(len(tag), 0x40)
             return True
     elif part[0] in "GM":
         try:
             code = int(part[1:])
         except (ValueError):
             self.StartStyling(pos + 1, 0x40)
             self.SetStyling(len(part) - 1, 0x40)
             return True
         if part[0] == 'G':
             if not code in self.supportedGCodes:
                 return True
         if part[0] == 'M':
             if not code in self.supportedMCodes:
                 return True
     else:
         try:
             float(part[1:])
         except (ValueError):
             self.StartStyling(pos + 1, 0x40)
             self.SetStyling(len(part) - 1, 0x40)
             return True
     return False
Пример #4
0
	def checkGCodePart(self, part, pos):
		if len(part) < 2:
			self.StartStyling(pos, 0x40)
			self.SetStyling(1, 0x40)
			return True
		if not part[0] in "GMXYZFESTBPIDCJ":
			self.StartStyling(pos, 0x40)
			self.SetStyling(1, 0x40)
			return True
		if part[1] == '{':
			if part[-1] != '}':
				return True
			tag = part[2:-1]
			if not profile.isProfileSetting(tag) and not profile.isPreference(tag):
				self.StartStyling(pos + 2, 0x40)
				self.SetStyling(len(tag), 0x40)
				return True
		elif part[0] in "GM":
			try:
				code = int(part[1:])
			except (ValueError):
				self.StartStyling(pos + 1, 0x40)
				self.SetStyling(len(part) - 1, 0x40)
				return True
			if part[0] == 'G':
				if not code in self.supportedGCodes:
					return True
			if part[0] == 'M':
				if not code in self.supportedMCodes:
					return True
		else:
			try:
				float(part[1:])
			except (ValueError):
				self.StartStyling(pos + 1, 0x40)
				self.SetStyling(len(part) - 1, 0x40)
				return True
		return False
Пример #5
0
	def getSimpleSettings(profile_setting, material_setting, other_settings):
		simple_settings = {}
		machine_type = profile.getMachineSetting('machine_type')
		if SimpleModeSettings.settings.has_key(machine_type):
			machine_settings = SimpleModeSettings.settings[machine_type]
		else:
			machine_settings = SimpleModeSettings.settings[None]

		for setting_dict in machine_settings:
			settings = setting_dict.get('Settings', None)
			ini = setting_dict.get('Ini', None)
			print_material = setting_dict.get('Material', None)
			print_profile = setting_dict.get('Profile', None)
			print_others = setting_dict.get('Options', None)
			# Check if the material/profile/other options match the settings
			if (print_material is None or print_material == material_setting) and \
			   (print_profile is None or print_profile == profile_setting) and \
			   (print_others is None or len(set(print_others)) == len(set(print_others).intersection(set(other_settings)))):
				if settings:
					for item in settings:
						if len(item) != 2 or not profile.isProfileSetting(item[0]):
							continue
						if hasattr(item[1], '__call__'):
							simple_settings[item[0]] = item[1]()
						else:
							simple_settings[item[0]] = item[1]
				if ini:
					ini_file = resources.getSimpleModeIniFiles('extra', ini + '.ini')
					if len(ini_file) > 0:
						cp = configparser.ConfigParser()
						cp.read(ini_file[0])
						for setting in profile.settingsList:
							if setting.isProfile() or setting.isAlteration():
								if cp.has_option('profile', setting.getName()):
									simple_settings[setting.getName()] = cp.get('profile', setting.getName())

		return simple_settings