chiark / gitweb /
Support slicing objects with different profiles in the project planner.
authordaid <daid303@gmail.com>
Thu, 10 May 2012 14:52:31 +0000 (16:52 +0200)
committerdaid <daid303@gmail.com>
Thu, 10 May 2012 14:52:31 +0000 (16:52 +0200)
Cura/gui/projectPlanner.py
Cura/images/set-profile.png [new file with mode: 0644]

index 67958a111681e4205fa2a67c5c05989cb7b5856d..310f67a2e1d5c26f19f40a2c60845f501624e772 100644 (file)
@@ -126,6 +126,7 @@ class ProjectObject(stl.stlModel):
                p.swapXZ = self.swapXZ\r
                p.swapYZ = self.swapYZ\r
                p.extruder = self.extruder\r
+               p.profile = self.profile\r
                \r
                p.updateModelTransform()\r
                \r
@@ -185,6 +186,7 @@ class projectPlanner(wx.Frame):
                toolbarUtil.NormalButton(self.toolbar2, self.OnMoveUp, 'move-up.png', 'Move model up in print list')\r
                toolbarUtil.NormalButton(self.toolbar2, self.OnMoveDown, 'move-down.png', 'Move model down in print list')\r
                toolbarUtil.NormalButton(self.toolbar2, self.OnCopy, 'copy.png', 'Make a copy of the current selected object')\r
+               toolbarUtil.NormalButton(self.toolbar2, self.OnSetCustomProfile, 'set-profile.png', 'Set a custom profile to be used to slice a specific object.')\r
                self.toolbar2.AddSeparator()\r
                toolbarUtil.NormalButton(self.toolbar2, self.OnAutoPlace, 'autoplace.png', 'Automaticly organize the objects on the platform.')\r
                toolbarUtil.NormalButton(self.toolbar2, self.OnSlice, 'slice.png', 'Slice to project into a gcode file.')\r
@@ -286,7 +288,6 @@ class projectPlanner(wx.Frame):
                        cp = ConfigParser.ConfigParser()\r
                        cp.read(dlg.GetPath())\r
                        self.list = []\r
-                       self.listbox.Clear()\r
                        i = 0\r
                        while cp.has_section('model_%d' % (i)):\r
                                section = 'model_%d' % (i)\r
@@ -309,9 +310,9 @@ class projectPlanner(wx.Frame):
                                i += 1\r
                                \r
                                self.list.append(item)\r
-                               self.listbox.AppendAndEnsureVisible(os.path.split(item.filename)[1])\r
-                       \r
-                       self.listbox.SetSelection(len(self.list)-1)\r
+\r
+                       self.selected = self.list[0]\r
+                       self._updateListbox()                   \r
                        self.OnListSelect(None)\r
                        self.preview.Refresh()\r
 \r
@@ -351,6 +352,7 @@ class projectPlanner(wx.Frame):
                                self.list.append(item)\r
                                self.selection = item\r
                                self._updateListbox()\r
+                               self.OnListSelect(None)\r
                self.preview.Refresh()\r
                dlg.Destroy()\r
        \r
@@ -394,10 +396,26 @@ class projectPlanner(wx.Frame):
                self._updateListbox()\r
                self.preview.Refresh()\r
        \r
+       def OnSetCustomProfile(self, e):\r
+               if self.selection == None:\r
+                       return\r
+\r
+               dlg=wx.FileDialog(self, "Select profile", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)\r
+               dlg.SetWildcard("Profile files (*.ini)|*.ini;*.INI")\r
+               if dlg.ShowModal() == wx.ID_OK:\r
+                       self.selection.profile = dlg.GetPath()\r
+               else:\r
+                       self.selection.profile = None\r
+               self._updateListbox()\r
+               dlg.Destroy()\r
+       \r
        def _updateListbox(self):\r
                self.listbox.Clear()\r
                for item in self.list:\r
-                       self.listbox.AppendAndEnsureVisible(os.path.split(item.filename)[1])\r
+                       if item.profile != None:\r
+                               self.listbox.AppendAndEnsureVisible(os.path.split(item.filename)[1] + " *")\r
+                       else:\r
+                               self.listbox.AppendAndEnsureVisible(os.path.split(item.filename)[1])\r
                if self.selection in self.list:\r
                        self.listbox.SetSelection(self.list.index(self.selection))\r
                elif len(self.list) > 0:\r
diff --git a/Cura/images/set-profile.png b/Cura/images/set-profile.png
new file mode 100644 (file)
index 0000000..a9f8c9e
Binary files /dev/null and b/Cura/images/set-profile.png differ