How to use the kiwisolver.strength.strong function in kiwisolver

To help you get started, we’ve selected a few kiwisolver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nucleic / enaml / enaml / layout / layout_manager.py View on Github external
if width_hint >= 0:
            if d.hug_width != 'ignore':
                cns.append((d.width == width_hint) | d.hug_width)
            if d.resist_width != 'ignore':
                cns.append((d.width >= width_hint) | d.resist_width)
            if d.limit_width != 'ignore':
                cns.append((d.width <= width_hint) | d.limit_width)
        if height_hint >= 0:
            if d.hug_height != 'ignore':
                cns.append((d.height == height_hint) | d.hug_height)
            if d.resist_height != 'ignore':
                cns.append((d.height >= height_hint) | d.resist_height)
            if d.limit_height != 'ignore':
                cns.append((d.height <= height_hint) | d.limit_height)

        strength = 0.1 * kiwi.strength.strong

        min_width, min_height = self.min_size()
        if min_width >= 0:
            cns.append((d.width >= min_width) | strength)
        if min_height >= 0:
            cns.append((d.height >= min_height) | strength)

        max_width, max_height = self.max_size()
        if max_width >= 0:
            cns.append((d.width <= max_width) | strength)
        if max_height >= 0:
            cns.append((d.height <= max_height) | strength)

        return cns

kiwisolver

A fast implementation of the Cassowary constraint solver

BSD-3-Clause
Latest version published 3 months ago

Package Health Score

91 / 100
Full package analysis

Similar packages