Exemplo n.º 1
0
    def _onSaveClick(self, e):
        storage_devices = getStorageDevices()
        if len(storage_devices) > 0:
            if len(storage_devices) == 1:
                path = storage_devices[0][1]
            else:
                dlg = wx.SingleChoiceDialog(self, _("Select SD drive"), _("Multiple removable drives have been found,\nplease select your SD card drive"), map(lambda n: n[0], storage_devices))
                if dlg.ShowModal() != wx.ID_OK:
                    dlg.Destroy()
                    return
                path = storage_devices[dlg.GetSelection()][1]
                dlg.Destroy()
            filename = os.path.join(path, self._app.getScene().getResult().getDefaultFilename())

            with open(filename, "wb") as f:
                f.write(self._app.getScene().getResult().getGCode())
            self._app.showNotification('Saved', 'Saved as %s' % (filename), lambda : threading.Thread(target=self._eject, args=(path,)).start())
        else:
            dlg = wx.FileDialog(self, _("Save toolpath"), style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
            dlg.SetFilename(self._app.getScene().getResult().getDefaultFilename())
            dlg.SetWildcard('Toolpath (*.gcode)|*.gcode')
            if dlg.ShowModal() != wx.ID_OK:
                dlg.Destroy()
                return
            filename = dlg.GetPath()
            dlg.Destroy()

            with open(filename, "wb") as f:
                f.write(self._app.getScene().getResult().getGCode())
Exemplo n.º 2
0
 def _updateButton(self, e=None):
     if len(getStorageDevices()) > 0:
         self.SetLabel("Save on")
         self.setIcon("save_sd_button.png")
     else:
         self.SetLabel("Save")
         self.setIcon("save_button.png")
Exemplo n.º 3
0
 def _updateButton(self, e=None):
     if len(getStorageDevices()) > 0:
         self.SetLabel('Save on')
         self.setIcon('save_sd_button.png')
     else:
         self.SetLabel('Save')
         self.setIcon('save_button.png')