Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
1.1 kB
6
Indexable
Never
def create_indices_list(total_range_start, total_range_end, start, end, x, y):
    selected_indices = []
    
    for i in range(total_range_start, total_range_end + 1):
        if start <= i <= end:
            # Inside slider values, select every xth index
            if (i - start) % x == 0:
                selected_indices.append(i)
        else:
            # Outside slider values, select every yth index
            if i < start:
                if (start - i) % y == 0:
                    selected_indices.append(i)
            else:
                if (i - end) % y == 0:
                    selected_indices.append(i)
    
    return selected_indices

# Example usage
total_range_start = 1  # Start of the total range
total_range_end = 100  # End of the total range
start = 20  # Obtained from QRangeSlider
end = 60    # Obtained from QRangeSlider
x = 3       # Obtained from a spinbox
y = 5       # Obtained from a spinbox

indices_list = create_indices_list(total_range_start, total_range_end, start, end, x, y)
print(indices_list)
Leave a Comment