Cross-platform apps with wxcairo

Hello,

I have just read Stani's manifesto on making cross-platform apps:

http://bazaar.launchpad.net/~stani/phatch/trunk/download/head:/cross_platform.html-20100313145653-x6390gcl4jyspt8u-2/cross_platform.html
(It's a download link.)

Among many other interesting things, he recommended making custom
widgets with cairo.

It looks like a good idea to me, so I'm positively considering
developing all my widgets on cairo.

I have a concern though: How sure I can be that it will work well when
I distribute my app to all OSes?

I have tried packaging it with py2exe, and it wasn't trivial. I had to
write a little module that temporarily monkeypatches
`sys.environ['PATH']` before importing `wx.lib.wxcairo`, so it will
find that cairo DLL. (Robin, why do you let it look only in `PATH`? I
suggest in future versions you will let it look in `sys.path` too.)

Eventually I succeeded packaging it with py2exe. But I have to wonder,
will wxcairo give me more problems down the road as I develop my cross-
platform app? I worry especially about py2app.

Did anyone here develop an app using wxcairo which was distributed to
all OSes? Or perhaps you know of someone like that? (Stani didn't.)

Ram.

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Given the lack of response I'll assume that there aren't any. I
decided to avoid cairo and I'll just keep using wxPython's drawing
methods for my widgets.

Ram.

···

On May 21, 2:07 am, cool-RR <ram.rac...@gmail.com> wrote:

Hello,

I have just read Stani's manifesto on making cross-platform apps:

http://bazaar.launchpad.net/~stani/phatch/trunk/download/head:/cross_
(It's a download link.)

Among many other interesting things, he recommended making custom
widgets withcairo.

It looks like a good idea to me, so I'm positively considering
developing all my widgets oncairo.

I have a concern though: How sure I can be that it will work well when
I distribute my app to all OSes?

I have tried packaging it with py2exe, and it wasn't trivial. I had to
write a little module that temporarily monkeypatches
`sys.environ['PATH']` before importing `wx.lib.wxcairo`, so it will
find thatcairoDLL. (Robin, why do you let it look only in `PATH`? I
suggest in future versions you will let it look in `sys.path` too.)

Eventually I succeeded packaging it with py2exe. But I have to wonder,
will wxcairo give me more problems down the road as I develop my cross-
platform app? I worry especially about py2app.

Did anyone here develop an app using wxcairo which was distributed to
all OSes? Or perhaps you know of someone like that? (Stani didn't.)

Ram.

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hello,

I have just read Stani's manifesto on making cross-platform apps:

http://bazaar.launchpad.net/~stani/phatch/trunk/download/head:/cross_platform.html-20100313145653-x6390gcl4jyspt8u-2/cross_platform.html
(It's a download link.)

Among many other interesting things, he recommended making custom
widgets with cairo.

It looks like a good idea to me, so I'm positively considering
developing all my widgets on cairo.

I have a concern though: How sure I can be that it will work well when
I distribute my app to all OSes?

Your installer can either include and install the dependencies, or specify that those dependencies are required before the install is done. Each platform has a different standard way to do that. Then write the startup code of your application such that it tests for the presence of those dependencies and fails gracefully if they are not there, like showing a message telling the user that something is missing and what they need to do to get it.

I have tried packaging it with py2exe, and it wasn't trivial. I had to
write a little module that temporarily monkeypatches
`sys.environ['PATH']` before importing `wx.lib.wxcairo`, so it will
find that cairo DLL. (Robin, why do you let it look only in `PATH`? I
suggest in future versions you will let it look in `sys.path` too.)

I used the standard find_library call provided by ctypes, which is supposed to do the Right Thing for locating shared libraries for each platform. For Windows the Right Thing is to search PATH and also the executable's location, although I'm not 100% sure if find_library is doing that last part... I have however modified wxcairo.py a few weeks back to additionally try to load the shared library without a path search. That will be in 2.8.11, or you can get it from SVN.

···

On 5/20/10 5:07 PM, cool-RR wrote:

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

cool-RR wrote:

Given the lack of response I'll assume that there aren't any. I
decided to avoid cairo and I'll just keep using wxPython's drawing
methods for my widgets.

Why not give it a try with a simple example - if you got py2exe to do it, you should be able to get py2app to do it. And I'd think Cairo would be easier on Linux, as it's part of the system.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hello,

I have just read Stani’s manifesto on making cross-platform apps:

http://bazaar.launchpad.net/~stani/phatch/trunk/download/head:/cross_platform.html-20100313145653-x6390gcl4jyspt8u-2/cross_platform.html

(It’s a download link.)

Among many other interesting things, he recommended making custom

widgets with cairo.

It looks like a good idea to me, so I’m positively considering

developing all my widgets on cairo.

I have a concern though: How sure I can be that it will work well when

I distribute my app to all OSes?

Your installer can either include and install the dependencies, or specify that those dependencies are required before the install is done. Each platform has a different standard way to do that. Then write the startup code of your application such that it tests for the presence of those dependencies and fails gracefully if they are not there, like showing a message telling the user that something is missing and what they need to do to get it.

I know how it’s supposed to be done, Robin. What worries me is whether it will cause any problems in the future.

I have tried packaging it with py2exe, and it wasn’t trivial. I had to

write a little module that temporarily monkeypatches

sys.environ['PATH'] before importing wx.lib.wxcairo, so it will

find that cairo DLL. (Robin, why do you let it look only in PATH? I

suggest in future versions you will let it look in sys.path too.)

I used the standard find_library call provided by ctypes, which is supposed to do the Right Thing for locating shared libraries for each platform. For Windows the Right Thing is to search PATH and also the executable’s location, although I’m not 100% sure if find_library is doing that last part… I have however modified wxcairo.py a few weeks back to additionally try to load the shared library without a path search. That will be in 2.8.11, or you can get it from SVN.

Thanks.

Ram.

···

On Mon, May 24, 2010 at 11:30 PM, Robin Dunn robin@alldunn.com wrote:

On 5/20/10 5:07 PM, cool-RR wrote:

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

I agree that it’ll probably be easy on Linux, and probably be possible with py2app on Mac, but I really prefer not to rely on something that wasn’t extensively battle-tested before.

Ram.

···

On Tue, May 25, 2010 at 1:17 AM, Christopher Barker Chris.Barker@noaa.gov wrote:

cool-RR wrote:

Given the lack of response I’ll assume that there aren’t any. I

decided to avoid cairo and I’ll just keep using wxPython’s drawing

methods for my widgets.

Why not give it a try with a simple example - if you got py2exe to do it, you should be able to get py2app to do it. And I’d think Cairo would be easier on Linux, as it’s part of the system.

-Chris

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

cool-RR wrote:

I agree that it'll probably be easy on Linux, and probably be possible with py2app on Mac, but I really prefer not to rely on something that wasn't extensively battle-tested before.

Fair enough.

One more comment, though -- my experience with py2app is that it either works or it doesn't -- so if you can get it to build and work, you're probably OK.

A key issue here is if you have other systems to test on -- it can be a bit tricky to get libs to work on older versions of OS-X than you are building on -- i.e. if you want it to work on 10.4 -- it'll be easier of you build on 10.4, and barring that, you really need to test there.

But an extra dependency is an extra dependency -- and Cairo is a big one -- so if you don't need it, by all means don't use it!

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Thanks for the py2app tips. A few months from now I will start using it and I’ll keep that in mind.

Ram.

···

On Tue, May 25, 2010 at 8:03 PM, Christopher Barker Chris.Barker@noaa.gov wrote:

cool-RR wrote:

I agree that it’ll probably be easy on Linux, and probably be possible with py2app on Mac, but I really prefer not to rely on something that wasn’t extensively battle-tested before.

Fair enough.

One more comment, though – my experience with py2app is that it either works or it doesn’t – so if you can get it to build and work, you’re probably OK.

A key issue here is if you have other systems to test on – it can be a bit tricky to get libs to work on older versions of OS-X than you are building on – i.e. if you want it to work on 10.4 – it’ll be easier of you build on 10.4, and barring that, you really need to test there.

But an extra dependency is an extra dependency – and Cairo is a big one – so if you don’t need it, by all means don’t use it!

-Chris

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en