How to use the pywaffle.fontawesome_mapping.icons.keys function in pywaffle

To help you get started, we’ve selected a few pywaffle 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 gyli / PyWaffle / pywaffle / waffle.py View on Github external
self._pa["font_size"] = self._pa["icon_size"]

            # TODO: deprecating icon_set
            if self._pa["icon_set"] != "solid" and self._pa["icon_style"] == "solid":
                self._pa["icon_style"] = self._pa["icon_set"]
                warnings.warn(
                    "Parameter icon_set is deprecated and will be removed in future version. Use icon_style instead.",
                    DeprecationWarning,
                )

            # If icon_set is a string, convert it into a list of same icon. It's length is the value's length
            # 'solid' -> ['solid', 'solid', 'solid', ]
            if isinstance(self._pa["icon_style"], str):
                self._pa["icon_style"] = [self._pa["icon_style"].lower()] * self.values_len
            elif set(self._pa["icon_style"]) - set(icons.keys()):
                raise KeyError("icon_set should be one of {}".format(", ".join(icons.keys())))

            # If icons is a string, convert it into a list of same icon. It's length is the value's length
            # '\uf26e' -> ['\uf26e', '\uf26e', '\uf26e', ]
            if isinstance(self._pa["icons"], str):
                self._pa["icons"] = [self._pa["icons"]] * self.values_len

            if len(self._pa["icons"]) != self.values_len:
                raise ValueError("Length of icons doesn't match the values.")

            # Replace icon name with Unicode symbols in parameter icons
            self._pa["icons"] = [
                icons[icon_style][icon_name] for icon_name, icon_style in zip(self._pa["icons"], self._pa["icon_style"])
            ]

            # Calculate icon size based on the block size
            tx, ty = self.ax.transData.transform([(0, 0), (0, block_x_length)])