<div dir="ltr">Thank you very much for your comments <span style="font-size:12.8000001907349px">Lawrence, although PySlope is just a effort in learning python, so I know that there shoud be many misundertandings :) And I am not sure if it was time to put it in the repo.</span></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-18 16:00 GMT-03:00  <span dir="ltr"><<a href="mailto:cairo-request@cairographics.org" target="_blank">cairo-request@cairographics.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send cairo mailing list submissions to<br>
        <a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:cairo-request@cairographics.org">cairo-request@cairographics.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:cairo-owner@cairographics.org">cairo-owner@cairographics.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of cairo digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: A new charting library (Lawrence D'Oliveiro)<br>
   2. Creating A Cairo Context Seems Quite Quick (Lawrence D'Oliveiro)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sat, 18 Apr 2015 08:48:54 +1200<br>
From: Lawrence D'Oliveiro <<a href="mailto:ldo@geek-central.gen.nz">ldo@geek-central.gen.nz</a>><br>
To: <a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
Subject: Re: [cairo] A new charting library<br>
Message-ID: <<a href="mailto:20150418084854.05334420@theon.geek-central.gen.nz">20150418084854.05334420@theon.geek-central.gen.nz</a>><br>
Content-Type: text/plain; charset=UTF-8<br>
<br>
On Fri, 17 Apr 2015 09:10:19 -0300, Elvis Teixeira wrote:<br>
<br>
> PROJECT INFO:<br>
> name: slope<br>
> type: Charting library<br>
> author: Elvis Teixeira (Brazil)<br>
> license: LGPL<br>
> link: <a href="https://github.com/elvismt/slope" target="_blank">https://github.com/elvismt/slope</a><br>
<br>
I was going to say this was a natural job for Python, and then I saw<br>
you were ahead of me. :)<br>
<br>
Some random comments:<br>
<br>
In PySlope/data.py, why not shorten Data.set_visible to<br>
<br>
    def set_visible(self, on):<br>
        c.slope_data_set_visible(self.cobj, on)<br>
<br>
Similarly for XyData.set_antialias in PySlope/xydata.py.<br>
<br>
Where you have a lot of instance attributes (e.g. XyChart, in<br>
PySlope/simple_charts.py), it can be a good idea to list these in a<br>
__slots__ class attribute. This way, when you try to assign to the wrong<br>
one, Python reports “no such attribute” rather than silently creating a<br>
new one. This helps prevent typos.<br>
<br>
In that same source file, how about shortening XyChart.axis to<br>
<br>
    def axis(self, name):<br>
        return \<br>
            self._metrics.get_axis \<br>
              (<br>
                {<br>
                    'top' : xymetrics.LEFT_AXIS,<br>
                    'left' : xymetrics.TOP_AXIS,<br>
                    'bottom' : xymetrics.BOTTOM_AXIS,<br>
                    'right' : xymetrics.RIGHT_AXIS,<br>
                }[name]<br>
              )<br>
<br>
You could even use enums, but that restricts you to Python 3.4 and<br>
later.<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sat, 18 Apr 2015 22:30:58 +1200<br>
From: Lawrence D'Oliveiro <<a href="mailto:ldo@geek-central.gen.nz">ldo@geek-central.gen.nz</a>><br>
To: <a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
Subject: [cairo] Creating A Cairo Context Seems Quite Quick<br>
Message-ID: <<a href="mailto:20150418223058.23781278@theon.geek-central.gen.nz">20150418223058.23781278@theon.geek-central.gen.nz</a>><br>
Content-Type: text/plain; charset=UTF-8<br>
<br>
I just added methods to my Path and Path.Segment types in Qahirah<br>
<<a href="https://github.com/ldo/qahirah" target="_blank">https://github.com/ldo/qahirah</a>> to compute extents and return<br>
flattened versions. These create a temporary Cairo context so I can use<br>
its append_path and copy_path_flat calls to do all the work. The<br>
overhead of this doesn’t seem too bad.<br>
<br>
As a baseline (on an already-created Cairo context), the Python sequence<br>
<br>
    ctx.new_path().append_path(path).copy_path_flat()<br>
<br>
takes 140µs for a simple rectangular path on my Core i7 (averaged over<br>
100,000 iterations using the Python timeit module), while<br>
<br>
    ctx.new_path().append_path(path).path_extents<br>
<br>
takes 59µs. For the new methods I have added, which create a new context<br>
on every call,<br>
<br>
    path.flatten()<br>
<br>
takes 162µs, while<br>
<br>
    path.extents<br>
<br>
takes 83µs. So the overhead in the former is about 16%, in the latter<br>
about 40%. Well short of the order-of-magnitude-or-more I was<br>
expecting/fearing...<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br>
<br>
------------------------------<br>
<br>
End of cairo Digest, Vol 117, Issue 15<br>
**************************************<br>
</blockquote></div><br></div>