Esempio n. 1
0
    def clean(self):
        cleaned_data = super(DetailedTimingForm, self).clean()

        flags_sync_scheme = cleaned_data.get('flags_sync_scheme')
        fields_to_nullify = []

#        analog_composite = (flags_sync_scheme ==
#                            DetailedTiming.Sync_Scheme.Analog_Composite)
#        bipolar_analog_composite = (flags_sync_scheme ==
#                          DetailedTiming.Sync_Scheme.Bipolar_Analog_Composite)
        digital_composite = (flags_sync_scheme ==
                             DetailedTiming.Sync_Scheme.Digital_Composite)
        digital_separate = (flags_sync_scheme ==
                            DetailedTiming.Sync_Scheme.Digital_Separate)

        if not digital_separate:
            fields_to_nullify.extend(['flags_horizontal_polarity',
                                      'flags_vertical_polarity'])
        else:
            fields_to_nullify.append('flags_serrate')

        if not digital_composite:
            fields_to_nullify.append('flags_composite_polarity')

        if digital_composite or digital_separate:
            fields_to_nullify.append('flags_sync_on_rgb')

        cleaned_data = form_nullify_fields(cleaned_data, fields_to_nullify)

        return cleaned_data
Esempio n. 2
0
    def clean(self):
        cleaned_data = super(DetailedTimingForm, self).clean()

        flags_sync_scheme = cleaned_data.get('flags_sync_scheme')
        fields_to_nullify = []

#        analog_composite = (flags_sync_scheme ==
#                            DetailedTiming.Sync_Scheme.Analog_Composite)
#        bipolar_analog_composite = (flags_sync_scheme ==
#                          DetailedTiming.Sync_Scheme.Bipolar_Analog_Composite)
        digital_composite = (flags_sync_scheme ==
                             DetailedTiming.Sync_Scheme.Digital_Composite)
        digital_separate = (flags_sync_scheme ==
                            DetailedTiming.Sync_Scheme.Digital_Separate)

        if not digital_separate:
            fields_to_nullify.extend(['flags_horizontal_polarity',
                                      'flags_vertical_polarity'])
        else:
            fields_to_nullify.append('flags_serrate')

        if not digital_composite:
            fields_to_nullify.append('flags_composite_polarity')

        if digital_composite or digital_separate:
            fields_to_nullify.append('flags_sync_on_rgb')

        cleaned_data = form_nullify_fields(cleaned_data, fields_to_nullify)

        return cleaned_data
Esempio n. 3
0
    def clean(self):
        cleaned_data = super(EDIDUpdateForm, self).clean()

        ### Basic display video input
        # Set unused video input fields to null
        bdp_video_input = cleaned_data.get('bdp_video_input')
        if not bdp_video_input:
            # Analog
            cleaned_data = form_nullify_fields(
                cleaned_data, ['bdp_video_input_dfp_1'])

            cleaned_data = self._check_required_field(
                cleaned_data, ['bdp_signal_level_standard'])
        else:
            # Digital
            cleaned_data = form_nullify_fields(
                cleaned_data, ['bdp_signal_level_standard',
                               'bdp_blank_to_black_setup',
                               'bdp_separate_syncs', 'bdp_composite_sync',
                               'bdp_sync_on_green_video',
                               'bdp_vsync_serration'])

        ### Monitor Range Limits
        mrl_fields = ['mrl_min_horizontal_rate', 'mrl_max_horizontal_rate',
                      'mrl_min_vertical_rate', 'mrl_max_vertical_rate',
                      'mrl_max_pixel_clock']
        mrl_secondary_gtf_fields = ['mrl_secondary_gtf_start_freq',
                                    'mrl_secondary_gtf_c',
                                    'mrl_secondary_gtf_m',
                                    'mrl_secondary_gtf_k',
                                    'mrl_secondary_gtf_j']

        # If monitor range limits is enabled make sure all its fields are
        # required
        monitor_range_limits = cleaned_data.get('monitor_range_limits')
        if monitor_range_limits:
            cleaned_data = self._check_required_field(cleaned_data, mrl_fields)

            # If Secondary GTF curve is enabled make sure all its fields are
            # required
            mrl_secondary_gtf_curve_support = cleaned_data.get(
                'mrl_secondary_gtf_curve_support')
            if mrl_secondary_gtf_curve_support:
                cleaned_data = self._check_required_field(
                    cleaned_data, mrl_secondary_gtf_fields)
            # If Secondary GTF curve is disabled set all its fields to null
            else:
                cleaned_data = form_nullify_fields(
                    cleaned_data, mrl_secondary_gtf_fields)
        # If Monitor Range Limits is disabled set all its fields to null
        else:
            cleaned_data = form_nullify_fields(cleaned_data, mrl_fields)
            cleaned_data = form_nullify_fields(
                cleaned_data, ['mrl_secondary_gtf_curve_support'])
            cleaned_data = form_nullify_fields(
                cleaned_data, mrl_secondary_gtf_fields)

        return cleaned_data
Esempio n. 4
0
    def clean(self):
        cleaned_data = super(EDIDUpdateForm, self).clean()

        # Basic display video input
        # Set unused video input fields to null
        bdp_video_input = cleaned_data.get('bdp_video_input')
        if not bdp_video_input:
            # Analog
            cleaned_data = form_nullify_fields(
                cleaned_data, ['bdp_video_input_dfp_1'])

            cleaned_data = self._check_required_field(
                cleaned_data, ['bdp_signal_level_standard'])
        else:
            # Digital
            cleaned_data = form_nullify_fields(
                cleaned_data, ['bdp_signal_level_standard',
                               'bdp_blank_to_black_setup',
                               'bdp_separate_syncs', 'bdp_composite_sync',
                               'bdp_sync_on_green_video',
                               'bdp_vsync_serration'])

        # Monitor Range Limits
        mrl_fields = ['mrl_min_horizontal_rate', 'mrl_max_horizontal_rate',
                      'mrl_min_vertical_rate', 'mrl_max_vertical_rate',
                      'mrl_max_pixel_clock']
        mrl_secondary_gtf_fields = ['mrl_secondary_gtf_start_freq',
                                    'mrl_secondary_gtf_c',
                                    'mrl_secondary_gtf_m',
                                    'mrl_secondary_gtf_k',
                                    'mrl_secondary_gtf_j']

        # If monitor range limits is enabled make sure all its fields are
        # required
        monitor_range_limits = cleaned_data.get('monitor_range_limits')
        if monitor_range_limits:
            cleaned_data = self._check_required_field(cleaned_data, mrl_fields)

            # If Secondary GTF curve is enabled make sure all its fields are
            # required
            mrl_secondary_gtf_curve_support = cleaned_data.get(
                'mrl_secondary_gtf_curve_support')
            if mrl_secondary_gtf_curve_support:
                cleaned_data = self._check_required_field(
                    cleaned_data, mrl_secondary_gtf_fields)
            # If Secondary GTF curve is disabled set all its fields to null
            else:
                cleaned_data = form_nullify_fields(
                    cleaned_data, mrl_secondary_gtf_fields)
        # If Monitor Range Limits is disabled set all its fields to null
        else:
            cleaned_data = form_nullify_fields(cleaned_data, mrl_fields)
            cleaned_data = form_nullify_fields(
                cleaned_data, ['mrl_secondary_gtf_curve_support'])
            cleaned_data = form_nullify_fields(
                cleaned_data, mrl_secondary_gtf_fields)

        return cleaned_data