コード例 #1
0
def test_move_to_next_monitor_wrap_end():
    console_file = open(os.path.join('.', 'test-resources', 'zoneminder-xml-console.xml'))
    tracker = ZmGroupTracker(console_file)
    monitors = tracker.get_current_group_monitors()
    monitor = None
    for i in xrange(len(monitors)):
        monitor = tracker.move_to_next_monitor()
    assert (monitor == monitors[0])
コード例 #2
0
def test_get_monitors():
    console_file = open(os.path.join('.', 'test-resources', 'zoneminder-xml-console.xml'))
    tracker = ZmGroupTracker(console_file)
    monitors = tracker.get_current_group_monitors()
    assert (monitors[0].id == '11')
    assert (monitors[1].id == '6')
    assert (monitors[2].id == '1')
    assert (monitors[3].id == '7')
    assert (monitors[4].id == '3')
    assert (monitors[5].id == '5')
    assert (monitors[6].id == '8')
    assert (monitors[7].id == '2')
    assert (monitors[8].id == '9')
    assert (monitors[9].id == '12')
    assert (monitors[10].id == '13')
コード例 #3
0
ファイル: zm_applet.py プロジェクト: MarkoHoe/zm-applet
    def refresh_monitor_group(self, data):
        def check_and_set_defaults(group_tracker):
            group_name = self.app_context.config.config[STARTING_GROUP_NAME]
            if group_name:
                group_tracker.set_current_group_by_name(group_name)
            monitor_name = self.app_context.config.config[
                STARTING_MONITOR_NAME]
            if monitor_name:
                group_tracker.set_current_monitor_by_name(monitor_name)

        if not self.first_group_load:
            new_tracker = ZmGroupTracker.create_from_json_api(data[0], data[1])
            if new_tracker:
                self.first_group_load = True
                check_and_set_defaults(new_tracker)
                self.app_context.group_tracker = new_tracker
                if new_tracker.current_monitor:
                    self.app_context.event_bus.publish_event(
                        app_events.INTERNAL_EVENT_SWITCH_TO_MONITOR_STREAM,
                        new_tracker.current_monitor)
        else:
            cur_group = self.app_context.group_tracker.current_group
            cur_monitor = self.app_context.group_tracker.current_monitor
            self.app_context.group_tracker.load_from_json_api(
                data[0], data[1], cur_group, cur_monitor)
コード例 #4
0
def test_move_to_prev_monitor():
    console_file = open(os.path.join('.', 'test-resources', 'zoneminder-xml-console.xml'))
    tracker = ZmGroupTracker(console_file)
    monitors = tracker.get_current_group_monitors()
    monitor = tracker.move_to_prev_monitor()
    assert (monitor == monitors[len(monitors) - 1])