(self, layer_shift=0, rebuild=1)
| 838 | return p, lst |
| 839 | |
| 840 | def canvas_dump(self, layer_shift=0, rebuild=1): |
| 841 | # type: (int, int) -> pyx.canvas.canvas |
| 842 | if PYX == 0: |
| 843 | raise ImportError("PyX and its dependencies must be installed") |
| 844 | canvas = pyx.canvas.canvas() |
| 845 | if rebuild: |
| 846 | _, t = self.__class__(raw(self)).build_ps() |
| 847 | else: |
| 848 | _, t = self.build_ps() |
| 849 | YTXTI = len(t) |
| 850 | for _, l in t: |
| 851 | YTXTI += len(l) |
| 852 | YTXT = float(YTXTI) |
| 853 | YDUMP = YTXT |
| 854 | |
| 855 | XSTART = 1 |
| 856 | XDSTART = 10 |
| 857 | y = 0.0 |
| 858 | yd = 0.0 |
| 859 | XMUL = 0.55 |
| 860 | YMUL = 0.4 |
| 861 | |
| 862 | backcolor = colgen(0.6, 0.8, 1.0, trans=pyx.color.rgb) |
| 863 | forecolor = colgen(0.2, 0.5, 0.8, trans=pyx.color.rgb) |
| 864 | # backcolor=makecol(0.376, 0.729, 0.525, 1.0) |
| 865 | |
| 866 | def hexstr(x): |
| 867 | # type: (bytes) -> str |
| 868 | return " ".join("%02x" % orb(c) for c in x) |
| 869 | |
| 870 | def make_dump_txt(x, y, txt): |
| 871 | # type: (int, float, bytes) -> pyx.text.text |
| 872 | return pyx.text.text( |
| 873 | XDSTART + x * XMUL, |
| 874 | (YDUMP - y) * YMUL, |
| 875 | r"\tt{%s}" % hexstr(txt), |
| 876 | [pyx.text.size.Large] |
| 877 | ) |
| 878 | |
| 879 | def make_box(o): |
| 880 | # type: (pyx.bbox.bbox) -> pyx.bbox.bbox |
| 881 | return pyx.box.rect( |
| 882 | o.left(), o.bottom(), o.width(), o.height(), |
| 883 | relcenter=(0.5, 0.5) |
| 884 | ) |
| 885 | |
| 886 | def make_frame(lst): |
| 887 | # type: (List[Any]) -> pyx.path.path |
| 888 | if len(lst) == 1: |
| 889 | b = lst[0].bbox() |
| 890 | b.enlarge(pyx.unit.u_pt) |
| 891 | return b.path() |
| 892 | else: |
| 893 | fb = lst[0].bbox() |
| 894 | fb.enlarge(pyx.unit.u_pt) |
| 895 | lb = lst[-1].bbox() |
| 896 | lb.enlarge(pyx.unit.u_pt) |
| 897 | if len(lst) == 2 and fb.left() > lb.right(): |
nothing calls this directly
no test coverage detected