Gramplets

February 14th, 2008

I looked into the Gramplet code Doug wrote for 3.0 for the first time. Some really complicated stuff is in there, but it does have some elegance. Mutual referral (A points to B points to A) is something I like to avoid myself, but we must all agree the Gramplet system is a wonderful pluggable addition to GRAMPS.

My foray into this code was due to requests on the user mailing list for better navigation on the pedigree view, later turned into a feature request. We often get requests to change the main views, but this is a very difficult balance. Too much information and many users are put off and want a simpler design, to little, and many users complain they don’t see what they want easily.

Hence my idea to see if the issue could not be solved with a floating gramplet, and two hours of hacking and trying to understand the code brought up a functional design. Things can be improved, but I like the result. An analogue idea can be used for other viewing purposes, giving more power to the user, without having tens of options to change a standard view. Eg a person gramplet, with an overview of information about the active person, visible on screen without opening the person editor and without the need to add a new view to achieve it. The user who wants the extra info just places an appropriate gramplet on his screen.

It was fun coding this, now back to reality and encoding bugs, database bugs and relative path problems…

Benny

3.0 artwork

January 22nd, 2008

Away with web 2.0, here comes 3.0!

As I’ve now been involved with GRAMPS development for a while, it is time to take up the burden of doing some writing on this blog. Let me write about one of my achievements for 3.0, the artwork. I’m really pleased with it, and hope you are too. You’ll have to be looking at it for an awful long time if you use GRAMPS regularly.

The call to rework the icons came from Don perhaps two years ago. He wanted to shift from the semi realistic look of 2.0.x to the new freedesktop/GNOME Tango style, and partially started that for 2.2.x in 2006. He is no graphical artist though, so this was only partially done. Now, it must be known that I cannot draw, nor paint, well, actually, I barely can hold a pen straight. However, I don’t mind to try, and try again, and again. The beauty with PC is you can mess up as much you want, you have UNDO, and ZOOM and whatnot to help along while you stumble. So that is how most of the new icons came about. In all fairness, most are shameless ripoffs of other Tango Icons, others are based on Gnome icons and for 2 or 3 some people send in improvements (eg the family view icon). You can see the changes here and a somewhat outdated page with the new icons here.

The consequence of all this work is that only the most generic icons are dependant of the base system, things like edit, add, list, … . All the rest will look the same whether you are on Windows or GNOME, … . This should help users as it means the screenshots on the manual will actually look mostly as they see them before them. The system is furthermore set up in such a way that one can override the base GRAMPS icons with icons from an icon set, provided they add icons for gramps. Well, that probably needs some testing, although 2007-04-01 did see it in action (see attachment there).

Is this it? Probably not. Some icons are still missing, eg the import and export. And styles keep changing. So if you are itching, tune in, and send in some suggestions, especially if you are a better artist than I am!

Options Part 2: A Success Story

November 5th, 2007

In part 1, I discussed the problems that were presented by something as simple as adding an option to suppress privacy information. Now, there is actually no debate as to whether this option should be included. Everyone agrees that it does. However, stepping back away from the problem and looking at it at the higher level can help resolve the problem.

During the early development of 3.0, Benny Malengier identified many problems with privacy. After a bit of discussion, we realized that the problem was bigger than we thought.

We took a step back, and looked at the real problem: We needed a consistent and centralized way of handling private data.

Fortunately, Brian Matherly had been doing a bit of research into the problem. He developed the concept of a “ProxyDatabase”. The idea was simple. We write a wrapper around the standard database. The purpose of the wrapper is to process the data in the database.

So, we created a PrivateProxyDatabase, which wraps the standard database. Each report is passed the ProxyDatabase instead of the standard database. This proxy database does all the work of filtering out the private data. If a person is private, the report does not even know that the person exists - the person is never returned by the proxy. Similar results occur for a Family, Source, etc.

Now, each report and exporter can be written without any concern for private information. The report simply assumes that it is writing all the data in the database. If privacy is requested, the report never receives any private data from the database.

So, as in part 1, the code to write a family is the same.

    write_father_info(family.get_father())
    write_mother_info(family.get_mother())
    for child in family.get_children():
       write_child_info(child)

No changes need to be made to handle privacy. Private data never reaches the report.

Additionally, now every report and every exporter could instantly handle private information without *any* modification to the report’s or exporter’s code. All that is required is that the call to the report or exporter be changed from:

   WriteReport(database)

to:

   if privacy:
     database = ProxyDatabase(database)
   WriteReport(database)

One conditional check in the standard report dialog now handles privacy for all reports.

So, by stepping back and designing a solution, instead of hacking a solution, has lead to code that is much more consistent, clean, and easier to maintain.

The developers did what Brian is now currently requesting:

  1. Communicating to identify the problem (inconsistent privacy handling).
  2. Stepping back to identify the root of the problem (privacy was not being handled in a centralized manner)
  3. Designing a good solution (a proxy database that handles the privacy information without requiring reports and exports to be modified)

Since then, we have been able to extend this concept to provide a FilterProxy and a LivingPersonProxy. Again, this has vastly simplified code, and now reports no longer need to worry about filtering data or handling living people.

Again, I bring up these examples to point out that these issues were resolved by discussion, analysis, and design. By stepping back and actually designing, were were able to remove the problems caused by the original quick hack.

We identified the “right” solution.

Options Part 1: A Nightmare

November 5th, 2007

I thought I would follow up with a two part message to stress the importance of design over hacking. Part 1 is “Options - A Nightmare”. Part 2 is “Options - A Success Story”. This is a real world case taken from the GRAMPS project.

Early in the project, we encountered the need to add the ability to suppress private information on export to GEDCOM. So, I approached it in the quick way. I added a button on the export, and a check in the code:

    if not person.is_private():
       write_person()

However, this quickly proved to be not enough. Names could be private. Events could be private. Sources could be private. So, more conditional checks where added. Dozens of:

    if not person.is_private():

checks were added.

Then we discovered that Families could contain people marked private. So we added checks in the write_family() task.

We went from:

    write_father_info(family.get_father())
    write_mother_info(family.get_mother())
    for child in family.get_children():
       write_child_info(child)

to:

    if not family.get_father().is_private():
       write_father_info(family.get_father())
    if not family.get_mother().is_private():
       write_mother_info(family.get_mother())
    for child in family.get_children():
       if not child.is_private():
          write_child_info(child)

But then, we realized that all members of a family could be private, in which case, we should not even output the family to the GEDCOM file. So you ended up with:

    suppress_family = False
    if (not family.get_father().is_private and
        not family.get_mother().is_private()):
       suppress_family = True
    for child in family.get_children():
       if child.is_private():
          suppress_family = True

    if not suppress_family:
       if not family.get_father().is_private():
          write_father_info(family.get_father())
       if not family.get_mother().is_private():
          write_mother_info(family.get_mother())
       for child in family.get_children():
          if not child.is_private():
             write_child_info(child)

Similar approaches had to be done for nearly every possible object. And the GEDCOM export when from a simple set of code to a rather complex bit of code.

Then it became obvious that not only the GEDCOM export needed privacy information, but every report and every exporter. So something as seemingly simple as an option for handling privacy made simple code into complex code.

Of course, since each exporter and each report were different from each other, the code had to be written differently for each report. And in true form, we did not always get it right in every implementation. And, not every report and exporter was modified to handle the privacy
suppression.

This is the current status of GRAMPS 2.2. Our quick fix for privacy has lead to a coding and maintenance nightmare. Take a look at the bug tracker and see how many bugs are filed against privacy handling. The quick fix has lead to a major nightmare from the developer’s perspective (maintaining and supporting the code) and the user’s perspective (bugs and different results for different exporters and importers).

So long, and thanks for all the fish

October 2nd, 2007

After 6 and a half years, it is time for me to step aside from running the GRAMPS project. Brian Matherly has agreed to take over my role on the project. Brian will be able to bring in some fresh ideas in addition to providing strong leadership for the project. Please welcome Brian in his new role.

Don

Words of wisdom

June 4th, 2007

I came across a quote from one of the people that I most admire - Mister Rogers.

Grandparents are both our past and our future. In some ways they are what has gone before, and in others they are what we will become.

Don

MediaWiki: this time it’s for real!

March 1st, 2007

As you may already know, the effort is underway to create a new wiki site for the GRAMPS project. We have tried PhpWiki and TikiWiki before, as well as PhpWebSite and other engines. However, it seems that we have finally found the ultimate solution: the MediaWiki engine.

The plan now is to transfer all contents of various gramps websites to this wiki: the main gramps-project.org site as well as the developers wiki. Most of the main site is already ported, although we still have to figure out the new format for news/announcements. Some of the developers contents is also transferred, but there’s always room for more.

Please help us maintain the clean and up-to-date wiki site by contributing to this wiki. Use Talk sections to discuss arguable edits, email gramps-users list if in doubt, teach us how to better utilize the MediaWiki if you know more about it. The new site looks clean and useable and is surprisingly easy to modify.

Alex

Rediscovering IDE’s

February 15th, 2007

Fifteen years ago I was an IDE weeny, I did lots of development in early versions of MS Visual Studio in C++. Then I changed jobs and found myself doing lots of multi-language development across Windows and lots of different Unix systems, in this world IDE’s just did not work. So I moved to doing everything in Emacs. I have been using Emacs ever since. Until now …

The software team at my work are big on Java and big on Eclipse. I have ignored Eclipse because I have always seen it as a Java tool. However, over the last few days I found that it is possible (using PyDev and Subclipse plugins) to turn Eclipse into a really nice Python development environment. I am converted. Code completion, integrated PyLint code checking, integrated python debugger with object browser, really flexibly screen layout and proper support for using multiple monitors (I always use two monitors on my desktop environment, and it works on Linux/Windows and Mac OSX (my laptop environment).

So if anyone wants to get into Gramps development but are used to GUI based IDE’s, then give Eclipse a go.

If only it would support Emacs key bindings, well you can have everything.

Richard

Improving Reports

February 14th, 2007

I have always had a soft spot in my heart for the Gramps report system. In my mind, writing database code is routine and thankless, and writing GUI code is uninteresting. But but the report system holds the power to give you infinite views into your data and to share it with other people. Personally, I think it is the most compelling reason to use Gramps. What good is a geneology database that can hold 100,000 people with a great user interface if you can’t get your data out?

I intended to work on reports during the development of the 2.2 series, but somehow the whole “Gramps on Windows” thing distracted me. So all I had time for was bug fixing. Now that “Gramps on Windows” is mostly behind me, I hope to concentrate on the report system during the 2.3 series.

Here are some of the things I hope to work on:

  • Clean up report interface
  • Make a clearer distinction between textDoc and drawDoc
  • Possibly add bookDoc
  • Document the report API
  • Add TOC and Index generation to the book report
  • Implement a couple of reports from the report specifications on the wiki
  • Convert HTML and (hopefully) GTK print to book report formats (in addition to OOo and ODF).
  • Improve source display (endnotes)

If you have any ideas that can help the report system, please share them on the mailing list or the wiki.

A community is forming

January 28th, 2007

For almost six years, the GRAMPS project has been working on the GRAMPS program. On more than one occasion, I have expressed frustration because it seemed as if the developers had to “go it alone”. Calls for help and participation seemed to fall on deaf years.

However, over the past couple of months, a startling transformation has occurred. People are getting more active on the mailing lists, the IRC channel, and in the development process itself. Initiatives are starting outside the core developers. Patches are being supplied. Users are starting to help users with issues. Things that I have longed to see happen are starting to happen.

A true community is forming. And I could not be happier.

Don