Advertisement
Guest User

Cura Manual Slide Option

a guest
Aug 5th, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.16 KB | None | 0 0
  1. Index: Cura/gui/mainWindow.py
  2. ===================================================================
  3. --- Cura/gui/mainWindow.py  (revision 2208)
  4. +++ Cura/gui/mainWindow.py  (working copy)
  5. @@ -115,6 +115,10 @@
  6.         self.profileFileHistory.UseMenu(profileHistoryMenu)
  7.         self.profileFileHistory.AddFilesToMenu()
  8.         self.Bind(wx.EVT_MENU_RANGE, self.OnProfileMRU, id=self.ID_MRU_PROFILE1, id2=self.ID_MRU_PROFILE10)
  9. +      
  10. +       self.fileMenu.AppendSeparator()
  11. +       i = self.fileMenu.Append(-1, _("Start Toolpath Computation\tCTRL+T"))
  12. +       self.Bind(wx.EVT_MENU, self.onToolpathStart, i)
  13.  
  14.         self.fileMenu.AppendSeparator()
  15.         i = self.fileMenu.Append(wx.ID_EXIT, _("Quit"))
  16. @@ -336,7 +340,10 @@
  17.             self.headOffsetWizardMenuItem.Enable(False)
  18.         self.scene.updateProfileToControls()
  19.         self.scene._scene.pushFree()
  20. -
  21. +  
  22. +   def onToolpathStart(self, e):
  23. +       self.scene.updateSceneAndRunEngine()
  24. +      
  25.     def onOneAtATimeSwitch(self, e):
  26.         profile.putPreference('oneAtATime', self.oneAtATime.IsChecked())
  27.         if self.oneAtATime.IsChecked() and profile.getMachineSettingFloat('extruder_head_size_height') < 1:
  28. Index: Cura/gui/preferencesDialog.py
  29. ===================================================================
  30. --- Cura/gui/preferencesDialog.py   (revision 2208)
  31. +++ Cura/gui/preferencesDialog.py   (working copy)
  32. @@ -51,6 +51,7 @@
  33.         configBase.SettingRow(right, 'auto_detect_sd')
  34.         configBase.SettingRow(right, 'check_for_updates')
  35.         configBase.SettingRow(right, 'submit_slice_information')
  36. +       configBase.SettingRow(right, 'automatic_slicing')
  37.  
  38.         self.okButton = wx.Button(right, -1, 'Ok')
  39.         right.GetSizer().Add(self.okButton, (right.GetSizer().GetRows(), 0), flag=wx.BOTTOM, border=5)
  40. Index: Cura/gui/sceneView.py
  41. ===================================================================
  42. --- Cura/gui/sceneView.py   (revision 2211)
  43. +++ Cura/gui/sceneView.py   (working copy)
  44. @@ -35,6 +35,8 @@
  45.  class SceneView(openglGui.glGuiPanel):
  46.     def __init__(self, parent):
  47.         super(SceneView, self).__init__(parent)
  48. +      
  49. +       self.layersDirty = True
  50.  
  51.         self._yaw = 30
  52.         self._pitch = 60
  53. @@ -386,6 +388,11 @@
  54.  
  55.     def OnViewChange(self):
  56.         if self.viewSelection.getValue() == 4:
  57. +           if self.layersDirty and profile.getPreference('automatic_slicing') != 'True':
  58. +               #ensure that we will eventually have some gcode to display in the layer view
  59. +               self.updateSceneAndRunEngine()
  60. +               threading.Timer(0.1, self.OnViewChange).start()
  61. +               return
  62.             self.viewMode = 'gcode'
  63.             self.tool = previewTools.toolNone(self)
  64.         elif self.viewSelection.getValue() == 1:
  65. @@ -542,17 +549,38 @@
  66.         self.sceneUpdated()
  67.  
  68.     def sceneUpdated(self):
  69. +       if profile.getPreference('automatic_slicing') == 'True':
  70. +           self._sceneUpdated()
  71. +       else:
  72. +           self.layersDirty = True
  73. +  
  74. +   def _sceneUpdated(self):
  75.         self._sceneUpdateTimer.Start(500, True)
  76.         self._engine.abortEngine()
  77.         self._scene.updateSizeOffsets()
  78.         self.QueueRefresh()
  79.  
  80.     def _onRunEngine(self, e):
  81. +       if profile.getPreference('automatic_slicing') == 'True':
  82. +           self.__onRunEngine(e)
  83. +          
  84. +   def __onRunEngine(self, e):
  85.         if self._isSimpleMode:
  86.             self.GetTopLevelParent().simpleSettingsPanel.setupSlice()
  87.         self._engine.runEngine(self._scene)
  88.         if self._isSimpleMode:
  89.             profile.resetTempOverride()
  90. +          
  91. +       #clear flag
  92. +       self.layersDirty = False
  93. +      
  94. +   #used when toolpath generation is set to 'Manual' mode
  95. +   def updateSceneAndRunEngine(self):
  96. +       #update scene
  97. +       self._sceneUpdated()
  98. +      
  99. +       #run engine
  100. +       self.__onRunEngine(None)
  101.  
  102.     def _updateEngineProgress(self, progressValue):
  103.         result = self._engine.getResult()
  104. Index: Cura/util/profile.py
  105. ===================================================================
  106. --- Cura/util/profile.py    (revision 2208)
  107. +++ Cura/util/profile.py    (working copy)
  108. @@ -473,6 +473,7 @@
  109.  setting('auto_detect_sd', 'True', bool, 'preference', 'hidden').setLabel(_("Auto detect SD card drive"), _("Auto detect the SD card. You can disable this because on some systems external hard-drives or USB sticks are detected as SD card."))
  110.  setting('check_for_updates', 'True', bool, 'preference', 'hidden').setLabel(_("Check for updates"), _("Check for newer versions of Cura on startup"))
  111.  setting('submit_slice_information', 'False', bool, 'preference', 'hidden').setLabel(_("Send usage statistics"), _("Submit anonymous usage information to improve future versions of Cura"))
  112. +setting('automatic_slicing', 'True', bool, 'preference', 'hidden').setLabel(_("Automatic slicing"), _("Automatically compute a new toolpath whenever settings are changed; if you disable this option you will need to manually start toolpath computation using 'File -> Start Toolpath Computation' or by pressing 'CTRL+T'."))
  113.  setting('youmagine_token', '', str, 'preference', 'hidden')
  114.  setting('filament_physical_density', '1240', float, 'preference', 'hidden').setRange(500.0, 3000.0).setLabel(_("Density (kg/m3)"), _("Weight of the filament per m3. Around 1240 for PLA. And around 1040 for ABS. This value is used to estimate the weight if the filament used for the print."))
  115.  setting('language', 'English', str, 'preference', 'hidden').setLabel(_('Language'), _('Change the language in which Cura runs. Switching language requires a restart of Cura'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement