예제 #1
0
    def __write_settings(self):
        """
        Zapisz wartości z widgetów
        """

        Configuration.distance_border1(self.border1_adjustment.get_value())
        Configuration.distance_border2(self.border2_adjustment.get_value())
        Configuration.meters_length(
            self.meters_length_spin_adjustment.get_value())
        Configuration.color_number(
            self.color_number_spin_adjustment.get_value())
        Configuration.horizontal_border(
            self.horizontal_border_spin_adjustment.get_value())
        Configuration.vertical_border(
            self.vertical_border_spin_adjustment.get_value())
        Configuration.pixel_limit(self.pixel_limit_spin_adjustment.get_value())
        Configuration.distance_from_border(
            self.distance_from_border_spin_adjustment.get_value())

        Configuration.draw_detection_region(
            self.draw_detection_region_check.get_active())
        Configuration.draw_speed_region(
            self.draw_speed_region_check.get_active())
        Configuration.draw_cars(self.draw_cars_check.get_active())
        Configuration.draw_conturs(self.draw_conturs_check.get_active())
        Configuration.draw_speed_info(self.draw_speed_info_check.get_active())
        Configuration.draw_size_info(self.draw_size_info_check.get_active())
        Configuration.draw_color_bar(self.draw_color_bar_check.get_active())

        Configuration.save_config()
예제 #2
0
    def __load_settings(self):
        """
        Wczytaj obecną konfigurację znajdującą się config.json do widgetów okna.
        """

        self.border1_adjustment.set_value(Configuration.distance_border1())
        self.border2_adjustment.set_value(Configuration.distance_border2())
        self.meters_length_spin_adjustment.set_value(
            Configuration.meters_length())
        self.color_number_spin_adjustment.set_value(
            Configuration.color_number())
        self.horizontal_border_spin_adjustment.set_value(
            Configuration.horizontal_border())
        self.vertical_border_spin_adjustment.set_value(
            Configuration.vertical_border())
        self.pixel_limit_spin_adjustment.set_value(Configuration.pixel_limit())
        self.distance_from_border_spin_adjustment.set_value(
            Configuration.distance_from_border())

        self.draw_detection_region_check.set_active(
            Configuration.draw_detection_region())
        self.draw_speed_region_check.set_active(
            Configuration.draw_speed_region())
        self.draw_cars_check.set_active(Configuration.draw_cars())
        self.draw_conturs_check.set_active(Configuration.draw_conturs())
        self.draw_speed_info_check.set_active(Configuration.draw_speed_info())
        self.draw_size_info_check.set_active(Configuration.draw_size_info())
        self.draw_color_bar_check.set_active(Configuration.draw_color_bar())
예제 #3
0
    def __is_on_right(new_car):
        """
        Sprawdza czy samochód jest blisko prawej krawędzi obszaru czułości.

        :param Vehicle new_car: Obserwoway samochód.
        :return: Prawda/fałsz.
        :rtype: bool
        """

        hborder = Configuration.horizontal_border()
        distance = Configuration.distance_from_border()
        return new_car.centerx > (Follower.__frame_width - hborder - distance)
예제 #4
0
    def __is_on_left(new_car: Vehicle):
        """
        Sprawdza czy samochód jest blisko lewej krawędzi obszaru czułości.

        :param Vehicle new_car: Obserwoway samochód.
        :return: Prawda/fałsz.
        :rtype: bool
        """

        hborder = Configuration.horizontal_border()
        distance = Configuration.distance_from_border()
        return new_car.centerx < (hborder + distance)
예제 #5
0
    def __is_on_right(new_car):
        """
        Sprawdza czy samochód jest blisko prawej krawędzi obszaru czułości.

        :param Vehicle new_car: Obserwoway samochód.
        :return: Prawda/fałsz.
        :rtype: bool
        """

        hborder = Configuration.horizontal_border()
        distance = Configuration.distance_from_border()
        return new_car.centerx > (Follower.__frame_width - hborder - distance)
예제 #6
0
    def __is_on_left(new_car: Vehicle):
        """
        Sprawdza czy samochód jest blisko lewej krawędzi obszaru czułości.

        :param Vehicle new_car: Obserwoway samochód.
        :return: Prawda/fałsz.
        :rtype: bool
        """

        hborder = Configuration.horizontal_border()
        distance = Configuration.distance_from_border()
        return new_car.centerx < (hborder + distance)
예제 #7
0
    def __write_settings(self):
        """
        Zapisz wartości z widgetów
        """

        Configuration.distance_border1(self.border1_adjustment.get_value())
        Configuration.distance_border2(self.border2_adjustment.get_value())
        Configuration.meters_length(self.meters_length_spin_adjustment.get_value())
        Configuration.color_number(self.color_number_spin_adjustment.get_value())
        Configuration.horizontal_border(self.horizontal_border_spin_adjustment.get_value())
        Configuration.vertical_border(self.vertical_border_spin_adjustment.get_value())
        Configuration.pixel_limit(self.pixel_limit_spin_adjustment.get_value())
        Configuration.distance_from_border(self.distance_from_border_spin_adjustment.get_value())

        Configuration.draw_detection_region(self.draw_detection_region_check.get_active())
        Configuration.draw_speed_region(self.draw_speed_region_check.get_active())
        Configuration.draw_cars(self.draw_cars_check.get_active())
        Configuration.draw_conturs(self.draw_conturs_check.get_active())
        Configuration.draw_speed_info(self.draw_speed_info_check.get_active())
        Configuration.draw_size_info(self.draw_size_info_check.get_active())
        Configuration.draw_color_bar(self.draw_color_bar_check.get_active())

        Configuration.save_config()
예제 #8
0
    def __load_settings(self):
        """
        Wczytaj obecną konfigurację znajdującą się config.json do widgetów okna.
        """

        self.border1_adjustment.set_value(Configuration.distance_border1())
        self.border2_adjustment.set_value(Configuration.distance_border2())
        self.meters_length_spin_adjustment.set_value(Configuration.meters_length())
        self.color_number_spin_adjustment.set_value(Configuration.color_number())
        self.horizontal_border_spin_adjustment.set_value(Configuration.horizontal_border())
        self.vertical_border_spin_adjustment.set_value(Configuration.vertical_border())
        self.pixel_limit_spin_adjustment.set_value(Configuration.pixel_limit())
        self.distance_from_border_spin_adjustment.set_value(Configuration.distance_from_border())

        self.draw_detection_region_check.set_active(Configuration.draw_detection_region())
        self.draw_speed_region_check.set_active(Configuration.draw_speed_region())
        self.draw_cars_check.set_active(Configuration.draw_cars())
        self.draw_conturs_check.set_active(Configuration.draw_conturs())
        self.draw_speed_info_check.set_active(Configuration.draw_speed_info())
        self.draw_size_info_check.set_active(Configuration.draw_size_info())
        self.draw_color_bar_check.set_active(Configuration.draw_color_bar())