[PythonCAD] Port to Maemo/Nokia 770

Gustavo Sverzut Barbieri barbieri at gmail.com
Mon Apr 3 14:52:45 CEST 2006


On 3/31/06, Art Haas <ahaas at airmail.net> wrote:
> > I'm not a CAD user, but I follow PythonCAD development because it's an
> > interesting project and I have some friends from closed-source world
> > that want to move to open alternatives.
> >
> > Why PythonCAD? My company, http://www.indt.org.br, is porting Python
> > to maemo platform and I think that PythonCAD would be a great test
> > program to it. It would also help engineers to have their drawings at
> > hand while on field analysis.
> >
> > Limitations:
> >  - 770 is really low on performance and memory, it doesn't have a FPU
> > and have low RAM available.
> >  - 770 has a great screen, 800x480, but it's high DPI, which make
> > drawing on the device not a great thing.
> >
> > So I plan to disable most "edit" features, like undo steps and
> > optimize to "view".
>
> Elimination of undo/redo will help somewhat in reducing memory, and I'm
> certain that a number of other memory saving opportunities exist in the
> program.

Ok, I'll do further research after I do the initial hildon-ization of
the main shell... it's easy, but my company job is taking much time
and I still don't have network access at home... moving home sucks,
you know it :-)


> > Any feedback is welcome, but mainly on these areas:
> >  - How to improve startup times? I did put PythonCAD dir in a zipfile
> > and used zipimport, it helps a bit, but need to make it faster... I
> > want to know if some imports could be lazy imports.
>
> My initial thoughts are that some sort of lazy 'import' calls will not
> work. If I had some patches that demonstrated how it could be done I
> would happily admit I was wrong.

I still need to research further... I'm also working with PyMaemo guys
to make "import pygtk" faster... it takes almost 3 seconds on my 770.

But the idea of lazy import is something like this: you know module X
is only used in the subsystem A, so you have:

X = None

def usage_of_subsystem_A():
    global X
    if X is None: X = __import__( 'X' )

this is the draft idea, you can also make X a callable that would load
the module itself on X, eliminating the explicit check.

But to make this work, I would need to know which modules were not
need at start up time, since adding these checks can slow things down,
there must be a reasonable number of modules to be imported later.



> >  - How to improve viewing/zoom?
>
> The current implementations are not great but they do work. I've wanted
> to improve viewing/zooming operations by replacing the 'GTKImage' class
> currently used for drawing display to other classes in the 'gtkshell.py'
> file. Last summer I'd started working towards this goal but I have not
> completed the coding unfortunately.

This is a branch or something like it?

Also, PythonCAD could use Cairo to let it handle vectors... but
unfortunately 770 still have no cairo. Anyway, it will have some day
and then it will make sense :-)


> >  - How to improve memory usage, the lower the better
>
> Reducing memory will be difficult as PythonCAD is built on top of both
> Python, the PyGTK bindings, and GTK+. I don't have any immediate ideas
> other than working to ensure the code does not keep unnecessary
> references around on entities it no longer needs. Accomplishing this
> goal requires more eyes scanning through the code, or perhaps some
> clever Python coding that will flush out stray references.
>
> Let me know what I can do to help you make your porting easier.

I think memory issue will be easier after I disable undo/redo. Maybe a
view-only mode that after things are drawn, you release the elements.
But this would need a canvas with vector support, because zoom still
needs to work.

--
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri at gmail.com
   MSN: barbieri at gmail.com
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
 Phone:  +1 (347) 624 6296; 08122692 at sip.stanaphone.com
   GPG: 0xB640E1A2 @ wwwkeys.pgp.net


More information about the PythonCAD mailing list