mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 15:37:27 -06:00
Use the new bits of API to add some more bits of printer application
This commit is contained in:
parent
abe19dfd9b
commit
e7a51b3bd8
1 changed files with 12 additions and 0 deletions
|
@ -9,12 +9,16 @@ from UM.Resources import Resources
|
||||||
from UM.Scene.BoxRenderer import BoxRenderer
|
from UM.Scene.BoxRenderer import BoxRenderer
|
||||||
from UM.Scene.Selection import Selection
|
from UM.Scene.Selection import Selection
|
||||||
|
|
||||||
|
from PlatformPhysics import PlatformPhysics
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
class PrinterApplication(QtApplication):
|
class PrinterApplication(QtApplication):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setApplicationName('printer')
|
self.setApplicationName('printer')
|
||||||
|
|
||||||
|
self._physics = None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self._plugin_registry.loadPlugins({ "type": "Logger"})
|
self._plugin_registry.loadPlugins({ "type": "Logger"})
|
||||||
|
@ -29,8 +33,14 @@ class PrinterApplication(QtApplication):
|
||||||
controller.setCameraTool("CameraTool")
|
controller.setCameraTool("CameraTool")
|
||||||
controller.setSelectionTool("SelectionTool")
|
controller.setSelectionTool("SelectionTool")
|
||||||
|
|
||||||
|
t = controller.getTool('TranslateTool')
|
||||||
|
if t:
|
||||||
|
t.setYRange(0.0, 0.0)
|
||||||
|
|
||||||
Selection.selectionChanged.connect(self.onSelectionChanged)
|
Selection.selectionChanged.connect(self.onSelectionChanged)
|
||||||
|
|
||||||
|
self._physics = PlatformPhysics(controller)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.getMachineSettings().loadValuesFromFile(Resources.getPath(Resources.SettingsLocation, 'ultimaker2.cfg'))
|
self.getMachineSettings().loadValuesFromFile(Resources.getPath(Resources.SettingsLocation, 'ultimaker2.cfg'))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
@ -90,6 +100,8 @@ class PrinterApplication(QtApplication):
|
||||||
if Selection.getCount() > 0:
|
if Selection.getCount() > 0:
|
||||||
if not self.getController().getActiveTool():
|
if not self.getController().getActiveTool():
|
||||||
self.getController().setActiveTool('TranslateTool')
|
self.getController().setActiveTool('TranslateTool')
|
||||||
|
|
||||||
|
self.getController().getTool('CameraTool').setOrigin(Selection.getSelectedObject(0).getGlobalPosition())
|
||||||
else:
|
else:
|
||||||
if self.getController().getActiveTool() and self.getController().getActiveTool().getName() == 'TranslateTool':
|
if self.getController().getActiveTool() and self.getController().getActiveTool().getName() == 'TranslateTool':
|
||||||
self.getController().setActiveTool(None)
|
self.getController().setActiveTool(None)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue