From af6d6a18d89023b031fd4858053fb666ce904b15 Mon Sep 17 00:00:00 2001 From: daid Date: Thu, 10 May 2012 16:52:31 +0200 Subject: [PATCH] Support slicing objects with different profiles in the project planner. --- Cura/gui/projectPlanner.py | 28 +++++++++++++++++++++++----- Cura/images/set-profile.png | Bin 0 -> 681 bytes 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 Cura/images/set-profile.png diff --git a/Cura/gui/projectPlanner.py b/Cura/gui/projectPlanner.py index 67958a11..310f67a2 100644 --- a/Cura/gui/projectPlanner.py +++ b/Cura/gui/projectPlanner.py @@ -126,6 +126,7 @@ class ProjectObject(stl.stlModel): p.swapXZ = self.swapXZ p.swapYZ = self.swapYZ p.extruder = self.extruder + p.profile = self.profile p.updateModelTransform() @@ -185,6 +186,7 @@ class projectPlanner(wx.Frame): toolbarUtil.NormalButton(self.toolbar2, self.OnMoveUp, 'move-up.png', 'Move model up in print list') toolbarUtil.NormalButton(self.toolbar2, self.OnMoveDown, 'move-down.png', 'Move model down in print list') toolbarUtil.NormalButton(self.toolbar2, self.OnCopy, 'copy.png', 'Make a copy of the current selected object') + toolbarUtil.NormalButton(self.toolbar2, self.OnSetCustomProfile, 'set-profile.png', 'Set a custom profile to be used to slice a specific object.') self.toolbar2.AddSeparator() toolbarUtil.NormalButton(self.toolbar2, self.OnAutoPlace, 'autoplace.png', 'Automaticly organize the objects on the platform.') toolbarUtil.NormalButton(self.toolbar2, self.OnSlice, 'slice.png', 'Slice to project into a gcode file.') @@ -286,7 +288,6 @@ class projectPlanner(wx.Frame): cp = ConfigParser.ConfigParser() cp.read(dlg.GetPath()) self.list = [] - self.listbox.Clear() i = 0 while cp.has_section('model_%d' % (i)): section = 'model_%d' % (i) @@ -309,9 +310,9 @@ class projectPlanner(wx.Frame): i += 1 self.list.append(item) - self.listbox.AppendAndEnsureVisible(os.path.split(item.filename)[1]) - - self.listbox.SetSelection(len(self.list)-1) + + self.selected = self.list[0] + self._updateListbox() self.OnListSelect(None) self.preview.Refresh() @@ -351,6 +352,7 @@ class projectPlanner(wx.Frame): self.list.append(item) self.selection = item self._updateListbox() + self.OnListSelect(None) self.preview.Refresh() dlg.Destroy() @@ -394,10 +396,26 @@ class projectPlanner(wx.Frame): self._updateListbox() self.preview.Refresh() + def OnSetCustomProfile(self, e): + if self.selection == None: + return + + dlg=wx.FileDialog(self, "Select profile", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST) + dlg.SetWildcard("Profile files (*.ini)|*.ini;*.INI") + if dlg.ShowModal() == wx.ID_OK: + self.selection.profile = dlg.GetPath() + else: + self.selection.profile = None + self._updateListbox() + dlg.Destroy() + def _updateListbox(self): self.listbox.Clear() for item in self.list: - self.listbox.AppendAndEnsureVisible(os.path.split(item.filename)[1]) + if item.profile != None: + self.listbox.AppendAndEnsureVisible(os.path.split(item.filename)[1] + " *") + else: + self.listbox.AppendAndEnsureVisible(os.path.split(item.filename)[1]) if self.selection in self.list: self.listbox.SetSelection(self.list.index(self.selection)) elif len(self.list) > 0: diff --git a/Cura/images/set-profile.png b/Cura/images/set-profile.png new file mode 100644 index 0000000000000000000000000000000000000000..a9f8c9ea1d20abef5299c1177d92a02fcb2ef90c GIT binary patch literal 681 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkEsab{I& zib7^`ejb-C9B^@IBx@=d85kHVcqL|+CMl?AW#;B4CaWt1m!xLqr55QZaAlN~6jh^D3oNRD!6<42I#=Fl$V$5rDx_A=;ars zr*|E9XJBBQ=jq}YQgLhQi(?WOK3ONY=IFbi4uyF;)+Rl*Pe>H@K6q)r z;~Liu8w9<*6`NYQ#f!w6ZaTNVaQ)*tDamZb(YeO=(>I!*ek*(M$wBe5v~RVQ@6VP$ z_;10V5yqK0SGKWVMc4GhJ??_GrM%C`o4uu*P?&#n16lyyLp?N zb8c^2)vq^+lkUv_IYp)N{nNeS^PX>ADrWHG>+Y1~&#KkG<8R)*`|!z1;X6C4C(m4U zo#C9N)m%Q;zzM062XYzMUmQR0zh=#xXActAPfJbP5~b_JlrP-^6*w`G^} z*YRF>J14RFkC=eb;WGxVI&MBzSE@H1Ncr^q#PtiWzfO~WAhXGXr%~X)(4i>;Op0u7 zi@(S0DOfu#UWB!B-gRCXh4^>I|30momLs-$QsL7}y|eaYsGi=G#dk(Yv4zbrb)tcI zOtRjss}-FB%XpKxisbaK&1We1`)chomA02H63)#ThDws(