am_manager = AlarmMonitorManager( AM_ALARM_TEMPLATE, am_type, AM_MAX_CHANS, display_duration=AM_DISPLAY_DURATION, base_template=AM_BASE_TEMPLATE, no_motion_check=AM_NO_MOTION_CHECK, ) am_manager.create_monitor(AM_MON) reactions.add_executor(am_manager) if AM_CHANGE_TEMPLATE_CHECK: logger.debug("Drop template enabled") host.activate_on_gui_event("", am_manager.drop_template) # ------------------------------------------------------- # Show message # ------------------------------------------------------- if SHOW_MESSAGE: from reactions import ShowMessage reactions.add_executor( ShowMessage(show_message_delay=SHOW_MESSAGE_DELAY)) # ------------------------------------------------------- # Show popup window # ------------------------------------------------------- if GLOBALS.get("SHOW_POPUP"): from reactions import ShowPopup
self.active_channel = guid def save_shot(self): if not self.active_channel: host.alert(tr("Channel not selected!")) else: channel = get_channel(self.active_channel) if channel is not None: paths = self.saver.save_shots([channel]) host.message(tr("Saving shot to <br><b>%s</b>") % paths[0]) else: host.error("Can't find channel %s" % self.active_channel) active_channel_handler = ActiveChannelHandler(saver) host.activate_on_gui_event("Focus Changed", active_channel_handler) host.activate_on_shortcut(SSO_BUTTON_ONE, active_channel_handler.save_shot) if EVENT_TYPE: def handler(ev): if not EVENT_OBJECTS or ev.origin_object.name in EVENT_OBJECTS: saver.save_shots() host.activate_on_events(EVENT_TYPE, "", handler) if SSA_INTERVAL: dt_start_ = datetime.datetime.strptime( "%s %s" % (SSA_DAY_START, SSA_TIME_START), "%d.%m.%Y %H:%M:%S" ) dt_end_ = datetime.datetime.strptime(
] logger.debug(carousel_list) for x in [z[1] for z in host.objects_list("IP Device")]: if x in carousel_list: raise ValueError( host.tr("Имеется IP устройство с именем канала %s") % host.object(x).name ) logger.debug("list %s done!" % carousel_list) return {x: z for x, z in enumerate(carousel_list)} def user_login(ev): if ev.username == USER: slide.hand_using_carousel(False) slide = Carousel( initialization(), HAND_USING, ("show_%s" % choice_dict[CHOICE]).lower() ) if ALARM_TEMPLATE: for event_type in event.compil_event(): host.activate_on_events(event_type, "", slide.attention) host.activate_on_shortcut("F1", lambda: slide.hand_using_carousel(False)) host.activate_on_shortcut("F2", lambda: slide.hand_using_carousel(True)) host.activate_on_shortcut("F5", lambda: slide.hand_using_go("up")) host.activate_on_shortcut("F6", lambda: slide.hand_using_go("down")) host.activate_on_gui_event("Focus Changed", slide.mous_handler) if USER: host.activate_on_events("Login Successful, %1 from %2", "", user_login)