[cairo] [ANN] CairoPad

Hakki Dogusan dogusanh at tr.net
Tue Dec 11 00:49:28 PST 2007


Hi,

Behdad Esfahbod wrote:
> On Mon, 2007-12-10 at 15:34 -0500, Carl Worth wrote:
>> I like the concept a lot. But I had no luck running it at all:
> 
>>From the description I read, Owen's Reinteract should be able to provide
> similar functionality using Python:
> 
>   http://www.reinteract.org/trac/
> 

 From Reinteract's introduction page: "..the results will flow through 
the part of the worksheet after the changed portion." Hmm..I'm not that 
clever! At each request, code is run fully as below:

-- from cairopad/app/panepaint.lua
local function OnPaint(T, event)
     local dc = wx.wxPaintDC(T)

     if theApp.paintauto or theApp.paintnow then
         local cr = cairo.CreateContext(wx.get_drawable(dc)) --HACK!

         local code = theApp.codectrl:GetValue()

         if code == "" then
             draw_greetings(cr)
         else
             local s = [[local cr = ... ; ]] .. code

             local fun, errstr = loadstring(s)
             if fun then
                 local rc, errstr = pcall(fun, cr)
                 if not rc then
                     draw_error(cr, errstr)
                 end
             else
                 draw_error(cr, errstr)
             end
         end

         cairo.destroy (cr)
     end

     theApp.paintnow  = false
     dc:delete()
end


--
Regards,
Hakki Dogusan


More information about the cairo mailing list