How to use the pyno.utils.centered function in pyno

To help you get started, we’ve selected a few pyno 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 honix / Pyno / pyno / element.py View on Github external
def put_pos(self, puts):
        # Calculate pos for pins
        for put in puts:
            yield {'name': put,
                   'pos': int(centered(self.x, self.w * 0.8,
                                       len(puts),
                                       puts.index(put)))}
github honix / Pyno / pyno / element.py View on Github external
def put_pos_by_name(self, name, mode):
        # Return pose x of pin by name
        if mode == 'outputs':
            for put in self.outputs:
                if put == name:
                    return int(centered(self.x, self.w * 0.8,
                                        len(self.outputs),
                                        self.outputs.index(put)))
        elif mode == 'inputs':
            for put in self.inputs:
                if put == name:
                    return int(centered(self.x, self.w * 0.8,
                                        len(self.inputs),
                                        self.inputs.index(put)))