From: daid Date: Tue, 23 Dec 2014 11:20:59 +0000 (+0100) Subject: Remember which quickprint profile was used. X-Git-Tag: 15.01-RC6~9 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c90ae3c14e264f67716d8c882c9ac3b797153398;p=cura.git Remember which quickprint profile was used. --- diff --git a/Cura/gui/simpleMode.py b/Cura/gui/simpleMode.py index 725a7aec..7b9e116e 100644 --- a/Cura/gui/simpleMode.py +++ b/Cura/gui/simpleMode.py @@ -20,23 +20,32 @@ class simpleModePanel(wx.Panel): for filename in resources.getSimpleModeProfiles(): cp = configparser.ConfigParser() cp.read(filename) - name = os.path.basename(filename) + base_filename = os.path.splitext(os.path.basename(filename))[0] + name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton(printTypePanel, -1, name, style=wx.RB_GROUP if len(self._print_profile_options) == 0 else 0) + button.base_filename = base_filename button.filename = filename self._print_profile_options.append(button) + if profile.getPreference('simpleModeProfile') == base_filename: + button.SetValue(True) printMaterialPanel = wx.Panel(self) for filename in resources.getSimpleModeMaterials(): cp = configparser.ConfigParser() cp.read(filename) - name = os.path.basename(filename) + base_filename = os.path.splitext(os.path.basename(filename))[0] + name = base_filename if cp.has_option('info', 'name'): name = cp.get('info', 'name') button = wx.RadioButton(printMaterialPanel, -1, name, style=wx.RB_GROUP if len(self._print_material_options) == 0 else 0) + button.base_filename = base_filename button.filename = filename self._print_material_options.append(button) + if profile.getPreference('simpleModeMaterial') == base_filename: + button.SetValue(True) + if profile.getMachineSetting('gcode_flavor') == 'UltiGCode': printMaterialPanel.Show(False) @@ -67,11 +76,20 @@ class simpleModePanel(wx.Panel): sizer.Add(boxsizer, (2,0), flag=wx.EXPAND) for button in self._print_profile_options: - button.Bind(wx.EVT_RADIOBUTTON, lambda e: self._callback()) + button.Bind(wx.EVT_RADIOBUTTON, self._update) for button in self._print_material_options: - button.Bind(wx.EVT_RADIOBUTTON, lambda e: self._callback()) + button.Bind(wx.EVT_RADIOBUTTON, self._update) + + self.printSupport.Bind(wx.EVT_CHECKBOX, self._update) - self.printSupport.Bind(wx.EVT_CHECKBOX, lambda e: self._callback()) + def _update(self, e): + for button in self._print_profile_options: + if button.GetValue(): + profile.putPreference('simpleModeProfile', button.base_filename) + for button in self._print_material_options: + if button.GetValue(): + profile.putPreference('simpleModeMaterial', button.base_filename) + self._callback() def getSettingOverrides(self): settings = {} diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 4b765493..7007cb3d 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -477,6 +477,8 @@ setting('postSwitchExtruder.gcode', """;Switch between the current extruder and """, str, 'alteration', 'alteration') setting('startMode', 'Simple', ['Simple', 'Normal'], 'preference', 'hidden') +setting('simpleModeProfile', '2_normal', str, 'preference', 'hidden') +setting('simpleModeMaterial', '1_pla', str, 'preference', 'hidden') setting('oneAtATime', 'True', bool, 'preference', 'hidden') setting('lastFile', os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'resources', 'example', 'UltimakerRobot_support.stl')), str, 'preference', 'hidden') setting('save_profile', 'False', bool, 'preference', 'hidden').setLabel(_("Save profile on slice"), _("When slicing save the profile as [stl_file]_profile.ini next to the model."))