def open(self): """Open module.""" Module.open(self) # open mixins WeatherAwareMixin.open(self) MotionStatusMixin.open(self)
def open(self): """Open image writer.""" Module.open(self) # subscribe to channel with new images log.info('Subscribing to new image events...') self.comm.register_event(NewImageEvent, self.process_new_image_event)
def open(self): """Open module.""" Module.open(self) import pyinotify class EventHandler(pyinotify.ProcessEvent): """Event handler for file watcher.""" def __init__(self, main, *args, **kwargs): """Create event handler.""" pyinotify.ProcessEvent.__init__(self, *args, **kwargs) self.main = main def process_IN_CLOSE_WRITE(self, event): """React to IN_CLOSE_WRITE events.""" self.main.add_image(event.pathname) # start watching directory if self._watchpath: log.info('Start watching directory %s for changes...', self._watchpath) wm = pyinotify.WatchManager() wm.add_watch(self._watchpath, pyinotify.IN_CLOSE_WRITE) self._notifier = pyinotify.ThreadedNotifier( wm, default_proc_fun=EventHandler(self)) #, name='observer') self._notifier.start()
def open(self): """Open module.""" Module.open(self) # subscribe to events if self.comm: self.comm.register_event(BadWeatherEvent) self.comm.register_event(GoodWeatherEvent)
def open(self): """Open module.""" Module.open(self) # subscribe to events if self.comm: self.comm.register_event(NewImageEvent) self.comm.register_event(ExposureStatusChangedEvent)
def open(self): """Open module.""" Module.open(self) # subscribe to events self.comm.register_event(FocusFoundEvent, self._on_focus_found) if self._filter_offsets is not None and self._filter_wheel is not None: self.comm.register_event(FilterChangedEvent, self._on_filter_changed)
def open(self): """Open module.""" Module.open(self) # subscribe to events if self.comm: self.comm.register_event(TaskStartedEvent, self._on_task_started) self.comm.register_event(TaskFinishedEvent, self._on_task_finished) self.comm.register_event(GoodWeatherEvent, self._on_good_weather)
def open(self): """Open module""" Module.open(self) # check telescope and camera try: self.proxy(self._telescope, ITelescope) self.proxy(self._camera, ICamera) except ValueError: log.warning('Either camera or telescope do not exist or are not of correct type at the moment.')
def open(self): """Open module""" Module.open(self) # check flat field try: self.proxy(self._flatfield, IFlatField) except ValueError: log.warning( 'Flatfield module does not exist or is not of correct type at the moment.' )
def open(self): """Open module.""" Module.open(self) # get a list of all events events = list(set([t['event'] for t in self._triggers])) # start self._running = True # register them for event in events: self.comm.register_event(event, self._handle_event)
def open(self): """Open module""" Module.open(self) # register event self.comm.register_event(FocusFoundEvent) # check focuser and camera try: self.proxy(self._focuser, IFocuser) self.proxy(self._camera, ICamera) except ValueError: log.warning('Either camera or focuser do not exist or are not of correct type at the moment.')
def open(self): """Open module.""" Module.open(self) # subscribe to events if self.comm: self.comm.register_event(TaskStartedEvent) self.comm.register_event(TaskFinishedEvent) # start self._running = True # open scheduler self._task_archive.open()
def open(self): """Open module""" Module.open(self) # check telescope, camera, and filters try: self.proxy(self._telescope, ITelescope) self.proxy(self._camera, ICamera) self.proxy(self._filters, IFilters) except ValueError: log.warning('Either telescope, camera or filters do not exist or are not of correct type at the moment.') # subscribe to events if self.comm: self.comm.register_event(BadWeatherEvent, self._abort_weather) self.comm.register_event(RoofClosingEvent, self._abort_weather)
def open(self): """Open module.""" Module.open(self) # check telescope try: self.proxy(self._telescope, ITelescope) except ValueError: log.warning( 'Given telescope does not exist or is not of correct type at the moment.' ) # check camera try: self.proxy(self._camera, ICamera) except ValueError: log.warning( 'Given camera does not exist or is not of correct type at the moment.' )