From: Bryan Mayland Date: Mon, 28 Oct 2013 18:08:38 +0000 (-0400) Subject: Add "Reload platform" to refresh all the objects on the platform from their files X-Git-Tag: 14.03~17^2~4^2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2d097188ce4b620f5f07ff5b7f849c09660576af;p=cura.git Add "Reload platform" to refresh all the objects on the platform from their files --- diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 75fd9dac..d954b952 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -57,6 +57,8 @@ class mainWindow(wx.Frame): self.Bind(wx.EVT_MENU, lambda e: self.scene.showLoadModel(), i) i = self.fileMenu.Append(-1, _("Save model...\tCTRL+S")) self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveModel(), i) + i = self.fileMenu.Append(-1, _("Reload platform\tF5")) + self.Bind(wx.EVT_MENU, lambda e: self.scene.reloadScene(e), i) i = self.fileMenu.Append(-1, _("Clear platform")) self.Bind(wx.EVT_MENU, lambda e: self.scene.OnDeleteAll(e), i) diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 4d2d9a62..8f677fb8 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -194,6 +194,14 @@ class SceneView(openglGui.glGuiPanel): self._animView = openglGui.animation(self, self._viewTarget.copy(), numpy.array([0,0,0], numpy.float32), 0.5) self._animZoom = openglGui.animation(self, self._zoom, newZoom, 0.5) + def reloadScene(self, e): + # Copy the list before DeleteAll clears it + fileList = [] + for obj in self._scene.objects(): + fileList.append(obj.getOriginFilename()) + self.OnDeleteAll(None) + self.loadScene(fileList) + def showLoadModel(self, button = 1): if button == 1: dlg=wx.FileDialog(self, _("Open 3D model"), os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST|wx.FD_MULTIPLE) @@ -687,6 +695,7 @@ class SceneView(openglGui.glGuiPanel): self.Bind(wx.EVT_MENU, self.OnMergeObjects, menu.Append(-1, _("Dual extrusion merge"))) if len(self._scene.objects()) > 0: self.Bind(wx.EVT_MENU, self.OnDeleteAll, menu.Append(-1, _("Delete all objects"))) + self.Bind(wx.EVT_MENU, self.reloadScene, menu.Append(-1, _("Reload all objects"))) if menu.MenuItemCount > 0: self.PopupMenu(menu) menu.Destroy()