chiark / gitweb /
Always give the choice for a custom file destination in the save gcode to SD
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Thu, 8 Jan 2015 19:01:49 +0000 (14:01 -0500)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Thu, 8 Jan 2015 19:01:53 +0000 (14:01 -0500)
Fixes issue #23

Cura/gui/sceneView.py

index 48c975d3e68344c7e43f947c1d9c8128524ab12a..f72fd6c6a9c489d99d1baa195e72b19624fc30a6 100644 (file)
@@ -259,16 +259,28 @@ class SceneView(openglGui.glGuiPanel):
                        if len(removableStorage.getPossibleSDcardDrives()) > 0 and (connectionGroup is None or connectionGroup.getPriority() < 0):
                                drives = removableStorage.getPossibleSDcardDrives()
                                if len(drives) > 1:
-                                       dlg = wx.SingleChoiceDialog(self, "Select SD drive", "Multiple removable drives have been found,\nplease select your SD card drive", map(lambda n: n[0], drives))
-                                       if dlg.ShowModal() != wx.ID_OK:
-                                               dlg.Destroy()
-                                               return
-                                       drive = drives[dlg.GetSelection()]
+                                       choices = map(lambda n: n[0], drives)
+                                       choices += ("Custom file destination", )
+                                       title = "Multiple removable drives have been found"
+                               else:
+                                       choices = [drives[0][0], "Custom file destination"]
+                                       title = "A removable drive has been found"
+
+                               dlg = wx.SingleChoiceDialog(self, "Select destination SD card drive\nYou can also select a custom file to save to", title, choices)
+                               if dlg.ShowModal() != wx.ID_OK:
                                        dlg.Destroy()
+                                       return
+                               try:
+                                       drive = drives[dlg.GetSelection()]
+                               except:
+                                       drive = None
+                               dlg.Destroy()
+
+                               if drive is None:
+                                       self.showSaveGCode()
                                else:
-                                       drive = drives[0]
-                               filename = self._scene._objectList[0].getName() + profile.getGCodeExtension()
-                               threading.Thread(target=self._saveGCode,args=(drive[1] + filename, drive[1])).start()
+                                       filename = self._scene._objectList[0].getName() + profile.getGCodeExtension()
+                                       threading.Thread(target=self._saveGCode,args=(drive[1] + filename, drive[1])).start()
                        elif connectionGroup is not None:
                                connections = connectionGroup.getAvailableConnections()
                                if len(connections) < 2: