mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Set translate tool as active/inactive on selection change in Printer
This commit is contained in:
parent
3786ced279
commit
e68e761598
1 changed files with 11 additions and 0 deletions
|
@ -7,6 +7,7 @@ from UM.Math.Matrix import Matrix
|
|||
from UM.Resources import Resources
|
||||
|
||||
from UM.Scene.BoxRenderer import BoxRenderer
|
||||
from UM.Scene.Selection import Selection
|
||||
|
||||
import os.path
|
||||
|
||||
|
@ -28,6 +29,8 @@ class PrinterApplication(QtApplication):
|
|||
controller.setCameraTool("CameraTool")
|
||||
controller.setSelectionTool("SelectionTool")
|
||||
|
||||
Selection.selectionChanged.connect(self.onSelectionChanged)
|
||||
|
||||
try:
|
||||
self.getMachineSettings().loadValuesFromFile(Resources.getPath(Resources.SettingsLocation, 'ultimaker2.cfg'))
|
||||
except FileNotFoundError:
|
||||
|
@ -82,3 +85,11 @@ class PrinterApplication(QtApplication):
|
|||
|
||||
def registerObjects(self, engine):
|
||||
pass
|
||||
|
||||
def onSelectionChanged(self):
|
||||
if Selection.getCount() > 0:
|
||||
if not self.getController().getActiveTool():
|
||||
self.getController().setActiveTool('TranslateTool')
|
||||
else:
|
||||
if self.getController().getActiveTool() and self.getController().getActiveTool().getName() == 'TranslateTool':
|
||||
self.getController().setActiveTool(None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue