Quantcast

How to set up addon development environment under windows.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to set up addon development environment under windows.

Matthias Basler
Hi gramps developers.
 
My name is Matthias Basler. I am a Java programmer and a GRAMPS user for some time now. I need to create a custom report as described in
  http://www.gramps-project.org/wiki/index.php?title=Report-writing_tutorial
 
Although I have no previous experience in phython I should think i can learn this language too. There are far greater problems for me to get started: The tutorial describes how to create the needed .py files for the report. My understanding is that it is required to compile these files to .pyo and .pyc files before GRAMPS can understand them, isn't it?
 
So I tried to follow this page to set up my development environment:
  http://www.gramps-project.org/wiki/index.php?title=Addons_development
but I was not able to understand some of the instructions given, maybe because they require knowledge that I don't have or maybe because they were never written for users like me.
 
In detail:
I wanted to do development using the Eclipse IDE with the Subclise 1.8 plugin (for SVN checkout) and PyDev plugin. I installed Python 3.2 for this and I am now able to compile small python scripts.
 
My questions are:
1. Is it really necessary to check out the gramps-addon project with all its existing reports, even if I do not currently intend to create a public addon, but just one rather specific report for own use.
 
2. There's this tip box on the development wiki page saying:

To use make.py as shown throughout this document, you may have to use:
GRAMPSPATH=/path/to/gramps python make.py ...
if the default ("../../..") is not correct.

I am sorry but I have no clue
a) where to set this path (as Windows environment variable, as project environment variable, anywhere else) and
b) what path you are referring to here (the path to GRAMPS AIO installation? To the bin directory? To the directory where the checked-out make.py?) Should I maybe not only specifiy a path but a whole command in this variable? Could you please provide a sample GRAMPSPATH value to learn from or make this information more explicit?
 
Whatever I tried, make.py was looking for something else on this path.
 
3. Has anyone ever tested this tutorial under Windows? Is it actually applicable for development under Windows?
 
4. is this make.py actually required? Or can I do without and happily code away in my Eclipse environment with an alternative set of steps to follow?
 
5. Where do I get the dependencies (the report API, database API etc) from? I guess I have to develop and compile against them, don't I?
 
Any help is appreciated.
 
Matthias Basler, Germany
[hidden email]

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to set up addon development environment under windows.

Tim Lyons
Administrator
Please note that I haven't actually tried out the things I suggest with a recent version of Gramps, so there may be some wrinkles that I haven't spotted.

If you just want to produce an addon for your own use, then the whole svn checkout and even the make is not necessary. I don't actually understand why the recipe suggests checking out all possible addon versions, rather than just the version that you want.

What I did originally for an addon is just to create  the Python text file in the addon directory, and edit it with my favourite text editor (TextWrangler, which does syntax colouring).

For Eclipse/Pydev what I have now is the main Gramps code as one project in Eclipse, and another project where I have my private addon. I think I had a symbolic link from my addon directory to the addon project (but I'm not sure as I haven't got that any-more, just the zip file of the developed addon). I haven't worked out how to get the definitions from gramps into the Pydev of the addon, but at least I get all the 'compilation' checking from pydev. Once the addon in loaded by the running gramps, it will link to all the dependencies; because python is interpreted, having the dependencies is not essential till run-time. Forget about the .pyo and .pyc files, these are created if necessary by the running code at execution time - you don't have to do anything with them.

I don't think you have to do make at all now with the new structure of gramps, at least not unless you have any translations for the addon.

So simply, you just have to make sure your .py and .gpr.py files are in the right place in the addons directory under ~/.gramps, then launch gramps, and the addon should magically be loaded and available for use. I suggest you get an existing addon of approximately the right kind for what you are trying to do, rename the files, edit it a bit with some print statements so you can tell it has executed properly, put it in the right place, then you will be able to check that you are at least getting the addon to execute. After that you can work out how to edit the code.

Hope this helps.

Tim.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to set up addon development environment under windows.

Matthias Basler
In reply to this post by Matthias Basler
Thanks you Heinz and Tim for your answers.
 
I finally made the first custom report (a copy of an existing one) show up in the report list.
It took me some time to find out that a special character "ü" in the textual description of my report (in .gpr.py) file prevented the report from showing up. Now that this character has been replaced it is visible and I can now start changing the report to my special needs.
 
I am glad I don't have to go to great lengths with a development environment and compilation and all that for just customizing reports.
 
Matthias Basler

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to set up addon development environment under windows.

Benny Malengier



2013/4/29 Matthias Basler <[hidden email]>
Thanks you Heinz and Tim for your answers.
 
I finally made the first custom report (a copy of an existing one) show up in the report list.
It took me some time to find out that a special character "ü" in the textual description of my report (in .gpr.py) file prevented the report from showing up. Now that this character has been replaced it is visible and I can now start changing the report to my special needs.

If you need non ascii char in the code, for python 2 you need to add at the top of your file the line:

# -*- coding: utf-8 -*-

And all will work. In python 3 it is assumed source files are in utf-8. Note that you must assure in windows that it really is utf-8 you add to the file, some editors might add utf-16!

Benny

I am glad I don't have to go to great lengths with a development environment and compilation and all that for just customizing reports.
 
Matthias Basler

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel



------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Loading...