Fixes for print information when running in headless mode

This commit is contained in:
ChrisTerBeke 2018-01-18 09:05:40 +01:00
parent 422d047317
commit 5e99fd6c1e

View File

@ -673,6 +673,10 @@ class CuraApplication(QtApplication):
for file_name in self._open_file_queue: # Open all the files that were queued up while plug-ins were loading. for file_name in self._open_file_queue: # Open all the files that were queued up while plug-ins were loading.
self._openFile(file_name) self._openFile(file_name)
# initialize info objects
self._print_information = PrintInformation.PrintInformation()
self._cura_actions = CuraActions.CuraActions(self)
self._started = True self._started = True
self.exec_() self.exec_()
@ -807,13 +811,10 @@ class CuraApplication(QtApplication):
def registerObjects(self, engine): def registerObjects(self, engine):
super().registerObjects(engine) super().registerObjects(engine)
# global contexts
engine.rootContext().setContextProperty("Printer", self) engine.rootContext().setContextProperty("Printer", self)
engine.rootContext().setContextProperty("CuraApplication", self) engine.rootContext().setContextProperty("CuraApplication", self)
self._print_information = PrintInformation.PrintInformation()
engine.rootContext().setContextProperty("PrintInformation", self._print_information) engine.rootContext().setContextProperty("PrintInformation", self._print_information)
self._cura_actions = CuraActions.CuraActions(self)
engine.rootContext().setContextProperty("CuraActions", self._cura_actions) engine.rootContext().setContextProperty("CuraActions", self._cura_actions)
qmlRegisterUncreatableType(CuraApplication, "Cura", 1, 0, "ResourceTypes", "Just an Enum type") qmlRegisterUncreatableType(CuraApplication, "Cura", 1, 0, "ResourceTypes", "Just an Enum type")