Exemple #1
0
	def run(self):
		if not self._allowRoot:
			self._checkForRoot()

		global printer
		global gcodeManager
		global userManager
		global eventManager
		global loginManager
		global debug

		from tornado.wsgi import WSGIContainer
		from tornado.httpserver import HTTPServer
		from tornado.ioloop import IOLoop
		from tornado.web import Application, FallbackHandler

		debug = self._debug

		# first initialize the settings singleton and make sure it uses given configfile and basedir if available
		self._initSettings(self._configfile, self._basedir)

		# then initialize logging
		self._initLogging(self._debug)
		logger = logging.getLogger(__name__)

		eventManager = events.eventManager()
		gcodeManager = gcodefiles.GcodeManager()
		gpioManager = gpio.gpioManager()
		monitorManager = monitor.monitorManager()
		printer = Printer(gcodeManager)
		gpioManager.setPrinter(printer)
		monitorManager.setPrinter(printer)

		# configure timelapse
		octoprint.timelapse.configureTimelapse()

		# setup system and gcode command triggers
		events.SystemCommandTrigger(printer)
		events.GcodeCommandTrigger(printer)
		events.SerialMonitor(printer)
		if self._debug:
			events.DebugEventListener()

		if settings().getBoolean(["accessControl", "enabled"]):
			userManagerName = settings().get(["accessControl", "userManager"])
			try:
				clazz = util.getClass(userManagerName)
				userManager = clazz()
			except AttributeError, e:
				logger.exception("Could not instantiate user manager %s, will run with accessControl disabled!" % userManagerName)
Exemple #2
0
	def eventCallback(self, event, payload):
		GenericEventListener.eventCallback(self, event, payload)
		if(payload != None):
			monitorManager().printEvent(str(event), str(payload))
		else:
			monitorManager().printEvent(str(event))