chiark / gitweb /
Adding new notifications for the user:
authorPierre-Marc Simard <pierrem.simard@gmail.com>
Mon, 2 Feb 2015 05:07:31 +0000 (00:07 -0500)
committerPierre-Marc Simard <pierrem.simard@gmail.com>
Mon, 2 Feb 2015 05:07:31 +0000 (00:07 -0500)
- print one at a time mode notification if it get disabled due to object too tall
- print one at a time mode re activated after removing object too tall. (do not occur when the mode was not previously disabled)
- Checking active plugins on launch to warn user of plugins still active when starting a new session.

Cura/gui/mainWindow.py
Cura/gui/pluginPanel.py
Cura/gui/sceneView.py
Cura/util/objectScene.py

index cc44fb235a6e454291e935f6f45a137551007653..dae60afe8502f58a817fb51eb7093eb74b9ba388 100644 (file)
@@ -285,6 +285,13 @@ class mainWindow(wx.Frame):
                if Publisher is not None:
                        Publisher().subscribe(self.onPluginUpdate, "pluginupdate")
 
+               pluginCount = self.normalSettingsPanel.pluginPanel.GetActivePluginCount()
+               if pluginCount == 1:
+                       self.scene.notification.message("Warning: 1 plugin from the previous session is still active.")
+
+               if pluginCount > 1:
+                       self.scene.notification.message("Warning: %i plugins from the previous session are still active." % pluginCount)
+
        def onPluginUpdate(self,msg): #receives commands from the plugin thread
                cmd = str(msg.data).split(";")
                if cmd[0] == "OpenPluginProgressWindow":
index 68b65e9abc2cc9e94034d82874e69d642b5480ef..fd69e6d1ad466f4b85c349c100de45a6d16128b4 100644 (file)
@@ -202,3 +202,14 @@ class pluginPanel(wx.Panel):
                if not os.path.exists(pluginInfo.getPluginBasePaths()[0]):
                        os.mkdir(pluginInfo.getPluginBasePaths()[0])
                explorer.openExplorerPath(pluginInfo.getPluginBasePaths()[0])
+
+       def GetActivePluginCount(self):
+               pluginCount = 0
+               for pluginConfig in self.pluginConfig:
+                       self._buildPluginPanel(pluginConfig)
+
+                       for pluginTest in self.pluginList:
+                               if pluginTest.getFilename() == pluginConfig['filename']:
+                                       pluginCount += 1
+
+               return pluginCount
\ No newline at end of file
index 29193f8a6662db11b947fb288129402174029ef0..dc9154771fa87b00b8260ed262875d219ba9ca90 100644 (file)
@@ -39,7 +39,7 @@ class SceneView(openglGui.glGuiPanel):
                self._yaw = 30
                self._pitch = 60
                self._zoom = 300
-               self._scene = objectScene.Scene()
+               self._scene = objectScene.Scene(self)
                self._objectShader = None
                self._objectLoadShader = None
                self._focusObj = None
@@ -121,6 +121,8 @@ class SceneView(openglGui.glGuiPanel):
                self.updateToolButtons()
                self.updateProfileToControls()
 
+
+
        def loadGCodeFile(self, filename):
                self.OnDeleteAll(None)
                #Cheat the engine results to load a GCode file into it.
index 29a52c051fa8a05ea103315a669a537e4dbb6d9f..c4ffd14284c7085e45cefe174b01ba2c3f8afa4c 100644 (file)
@@ -108,7 +108,7 @@ class Scene(object):
        The scene class keep track of an collection of objects on a build platform and their state.
        It can figure out in which order to print them (if any) and if an object can be printed at all.
        """
-       def __init__(self):
+       def __init__(self, sceneView=None):
                self._objectList = []
                self._sizeOffsets = numpy.array([0.0,0.0], numpy.float32)
                self._machineSize = numpy.array([100,100,100], numpy.float32)
@@ -122,6 +122,10 @@ class Scene(object):
                self._gantryHeight = 60
                self._oneAtATime = True
 
+               self._lastOneAtATime = False
+               self._lastResultOneAtATime = True
+               self._sceneView = sceneView
+
        # update the physical machine dimensions
        def updateMachineDimensions(self):
                self._machineSize = numpy.array([profile.getMachineSettingFloat('machine_width'), profile.getMachineSettingFloat('machine_depth'), profile.getMachineSettingFloat('machine_height')])
@@ -161,10 +165,28 @@ class Scene(object):
                self._headSizeOffsets[0] = min(xMin, xMax)
                self._headSizeOffsets[1] = min(yMin, yMax)
                self._gantryHeight = gantryHeight
-               self._oneAtATime = self._gantryHeight > 0 and profile.getPreference('oneAtATime') == 'True'
-               for obj in self._objectList:
-                       if obj.getSize()[2] - objectSink > self._gantryHeight:
-                               self._oneAtATime = False
+
+               printOneAtATime = profile.getPreference('oneAtATime') == 'True'
+               self._oneAtATime = self._gantryHeight > 0 and printOneAtATime
+               if self._oneAtATime:
+                       if not self._lastOneAtATime:
+                               #print mode was changed by user. We need to reset that value to test with current scene content
+                               self._lastResultOneAtATime = True
+
+                       for obj in self._objectList:
+                               if obj.getSize()[2] - objectSink > self._gantryHeight:
+                                       self._oneAtATime = False
+                                       if self._lastResultOneAtATime:
+                                               if self._sceneView:
+                                                       self._sceneView.notification.message("Info: Print one at a time mode disabled. Object too tall.")
+                                               break
+
+               if self._lastOneAtATime and self._oneAtATime and not self._lastResultOneAtATime:
+                       if self._sceneView:
+                               self._sceneView.notification.message("Info: Print one at a time mode re-enabled.")
+
+               self._lastResultOneAtATime = self._oneAtATime
+               self._lastOneAtATime = printOneAtATime
 
                headArea = numpy.array([[-xMin,-yMin],[ xMax,-yMin],[ xMax, yMax],[-xMin, yMax]], numpy.float32)