Tag Archives: Glom

www.glom.org

libepc

I’m very pleased with the libepc library that Mathias Hasselmann created for Glom. I much prefer having the Avahi and network communication wrapped up in a simple separate library rather than mixing it in with Glom’s source code. I don’t want to deal with avahi, libsoup and gnutls if I don’t have to.

Glom will effectively use it to discover and load .glom documents over the network from other Glom instances. I suspect that it will be useful to a few other applications, but if not then it will still have been a good exercise in modularity.

I’ve already reviewed a few iterations of the library. Mathias and I are both fussy coders, though in different ways, so that’s why it already has full and meaningful documentation, tests, and examples. But we would welcome feedback so we can show how seriously we take documentation and API. I’ve added it to jhbuild.

goocanvas experiences

I’ve got to know goocanvas (API documentation, browse CVS) better over the last week. I achieved what I needed, but it could have been easier.

No generic positioning of items

You can’t set the position of goocanvas items. Well, you can set the x,y position of a GooCanvasRect, and you can set the points in a GooCanvasPolyline, but there is no generic position API in the base GooCanvasItem interface.

This makes it very difficult to write generic code for dragging, loading, and saving. All the items could support a generic API – it wouldn’t matter if the x,y is some arbitrary point in the item. I have implemented this in derived classes in C++, with some multiple inheritance awkwardness, but life would be far easier if it was in the GooCanvasItem base class itself. Erik Osheim did this in Python too. You wouldn’t want to do it in C. It seems to be a regression compared to libgnomecanvas, which has gnome_canvas_item_move().

Note that you can “translate” generic GooCanvasItem items, but

  • Two APIs for the same thing, to be used at different times, is annoying.
  • You can’t easily discover the actual position after translating. For instance, the GooCanvasRect x,y properties are not changed by goo_canvas_item_translate(). That function just changes a translation matrix which is applied to the x,y, rather than changing x,y.

I guess this is the cairo drawing system, but the canvas API shouldn’t force that on me. This is a major problem in the API for me, so I hope I can persuade Damon to let us add this.

Update: We created a GooCanvas generic positioning patch for this.

No high-level funtionality

You have to implement too much yourself. Not every application needs the ability to drag and resize items, but many do, and it would be nice if this was easy and consistent. I implemented drag-to-move, snap to grid, snap to rules, ctrl-to-restrict-drag-to-one-axis, resizing via corners and edges with appropriate arrow cursors, and signalling for a context menu on right-click. I still need to do selection highlighting and moving of multiple selections. I did that with a CanvasGroupResizable class that can take a child to be manipulated, though it currently only works with a rectangle child. It uses the generically-movable rectangles and lines that I mentioned above.

The next person to reimplement this will probably make it behave subtly differently.

Now that I finally have a canvas with the basic functionality that I need, I was able to reimplement and improve Glom’s Relationships Overview. I’ll now start using it to implement print layouts showing field data.

Printing is easy

goo_canvas_render() makes printing really easy with GtkPrintOperation.

Minor issues

  • Instead of having a GooCanvasContainer type, there’s a goo_canvas_item_is_container() function that tells you whether goo_canvas_item_get_child() and friends are useful.
    Damon seems to like the idea of correcting this. Update: We created a GooCanvas Container-type patch for this.
  • The root item idea doesn’t seem useful. You always have to use goo_canvas_get_root_item() to actually add or remove items to the canvas. I’d like to make the GooCanvas widget implement the GooCanvasContainer interface instead.
  • The model/view separation doesn’t seem useful, though I might be persuaded by a real life example. I don’t see a big need to display the same canvas twice in the same UI. In GtkTreeView the model/view separation allows you to show two views with differently sorted or filtered models, but I don’t see an equivalent in goocanvas. I can imagine using different zoom levels or different visibility (at different zooms) levels, but I don’t see a way to specify that for a canvas “view”.
  • The *_new() functions need to be fixed to just use g_object_new(), for language bindings. Bug filed.
  • The *_new() functions, such as goo_canvas_rect_new() correctly return an initial reference if you pass NULL for the parent parameter, but do not return a reference if you specify a parent. That’s maybe convenient if you can remember, but its’ an invitation to make mistakes.

At first glance, libccc has many of the same problems. Note that I was dissuaded from trying libccc first because it was started after goocanvas, without any stated reason, and due to the lack of documentation on the functions that I looked at.

I should look at HippoCanvas too.

Glom: Print layouts

As mentioned before, Glom needs a more precise way to specify print layouts, for instance to print on a pre-printed form. I’m looking at the problem again. At the same time, Johannes is working on a prettier drag-and-drop UI for Glom’s regular (automatic) view layouts.

For now, I think I’ll start with text areas that don’t move or shrink depending on their content. But for later I would like to gather some examples of how other software does this. I wasn’t impressed with what I found, though FileMaker is the best of the bunch:

FileMaker print layouts

FileMaker offers two ways to achieve this: You can use the <<fieldname>> placeholder format in static text, or you can specify that a field’s text box will be moved left, right, up or down until it hits another box. Both techniques can be seen in this screenshot:

FileMaker designing print layout

Kexi print layouts

Kexi (version 1.1.3) doesn’t seem to have any support for printing, but please correct me if I’m wrong. (Update: It doesn’t support printing of details forms – the print menu is grayed out in that case. It does support printing of list views, though the result is arranged differently than what’s on screen. It has a reports feature, available under “queries”. For me, a report is for multiple records, not a single record, and I’d like to keep them separate to keep things simple.) However, the regular layout is pixel-perfect rather than automatic, which would be suitable for precise printing, though awful for all other situations.

kexi_layout.png

Knoda print layouts

Knoda (version 0.8.3) seems to support printing, but I didn’t find any features to support flowing of variable sized text. Its layout is pixel-perfect rather than automatic, as with Knoda and Access.

knoda_form_editor.png

Microsoft Access

It looks like Access (the version in Office 2007) also doesn’t have special printing support. I think you are just meant to design a regular custom form and print it. But I couldn’t find a way to print an invoice in their “Northwind” example, so I’m guessing. The regular layout is pixel-perfect, with the ability to make widgets stretch to fill available screen space, with the new “Anchoring” feature in Access 2007.

As seen in this screenshot they also use an invented markup (or mini programming language) to show data, as in FileMaker, but it’s even more complicated here.

access_2007_layout.png

libgda reports

libgda has some reports support (example). It uses custom XML tags (and a custom mini programming language for conditionals) to replace XML nodes (arbitrarily named, without any libgda prefix, it seems, such as <row>) with query results in, for instance, DocBook. So that’s not really useful for the precise layout problem and seems targeted more at multiple rows reports rather than single record printouts. Glom already has its reports feature which seems equivalent, though it is more integrated with Glom concepts such as Relationships and Related Fields.

Others?

What other systems should I look at? Note that I’m not interested in anything that requires the user to edit XML or SQL queries, though it’s possible that I could reuse some of that implementation some day.
By the way, having to use all these other systems for a while convinced me once again how badly Glom is needed. They are so unnecessarily low level and complicated, instead of directly helping people to achieve their actual goals.

libgda: iterator-based data models

I finally had a chance to test out Vivien Malerba’s cursor support in libgda, and fixed some problems. It lets you use the “ITER_MODEL_ONLY” parameter to get a GdaDataModel that should be used only via a GdaDataModelIter iterator. That uses the SQL “FETCH” command to get chunks of rows at a time instead of getting all the rows even if you are only interested in a few of them. I added an example of this to libgdamm.

For instance, Glom won’t cause libgda to get all one million records to show you a list of all records if the GtkTreeView only has space to show ten at a time. However, I’m not sure if it will get all the intermediate data when someone moves the scrollbar quickly from row 1 to row 500,000, because of this comment in the PostgreSQL documentation for FETCH. I’d like to avoid hacking on Postgres to fix that.

"ABSOLUTE fetches are not any faster than navigating to the desired row with a relative move: the underlying implementation must traverse all the intermediate rows anyway.”

So far this is only implemented for libgda’s PostgreSQL provider. It would be great if people could implement it for the other providers. The “FETCH” command seems to be fairly standard SQL, so it should be easy.

Glom 1.6

I released Glom 1.6. It’s mostly just a port to libgda 3.0 (from libgda 1.2). That makes life easier for people working on the code. We might have broken some things while doing that, so please do report bugs so we can fix them.

Glom 1.8 should be out in approximately six months from now. It’s likely to include an easier layout designer, using drag-and-drop, and a client-only Maemo version for the Nokia Internet Tablet.

Self-Improvement Projects

In a month or so, I should have more time. There’s a couple of things I want to do.

  • Buy a Playstation 3 and get a clue again about how kids use technology now. I doubt that anything has really changed in the last ten years, compared to Quake and Unreal, but there’s a chance, and I don’t want to become outmoded.
  • Get the latest edition of Thinking In Java and play with Google’s Web Toolkit. It might be what I need to implement the Glom web UI. Nobody else is doing that so I might as well try it slowly.

Glom ported to libgda 3.0

A little while ago, Vivien Malerba released libgda 3.0.0 (and libgnomedb 3.0.0), so it’s now finally API/ABI stable. This was a long hard push, but we pulled everything together and got it done. Vivien deserves many thanks for his relentless bug-fixing.

C++ bindings are already available: libgdamm 3.0 and libgnomedbmm 3.0, with lots of documentation, though I will wait before declaring them API stable. Our examples and Glom were much needed test cases for libgda and libgnomedb.

Armin has already ported Glom to libgdamm 3.0, and just merged that work into svn trunk for the future Glom 1.6. It needs the svn version of libgda until there’s a 3.0.1 release. This is another large step on the way to accessing the database efficiently, instead of reading every single row into memory when showing a list, which is silly.

Also, Andreas Nilsson cleaned up the Glom icons a bit:

Glom 1.4

Glom 1.4.0 is out. Glom is an easy-to-use database system, which is gradually becoming more useful. It’s already available in Ubuntu 7.04 (Feisty, not yet final) [1] thanks to Daniel Holbach and Martin Pitt.

New features in Glom 1.4

  • Self-hosting: Databases can now be created in a local directory, without the pain of configuring a central PostgreSQL server. PostreSQL is still used to host the database on your local computer. You may, for instance, send an archive of this directory in an email. PostgreSQL is therefore now a non-optional dependency.
    In future, a client-only version of Glom might be available for embedded devices.
  • Details view:
    • Related Records: Allow viewing of doubly-related records.
    • A vertical scrollbar now allows the window to be smaller when necessary on your screen.
  • List View: Now supports static text items, static pictures, and script buttons, as the Details view already did.
  • Field Formatting: Allow the user to remove a previously-chosen Also Show field.
  • Translations: Added Import and Export buttons, so you can use the standard .po format.
  • Calculated Fields and Button Scripts: Now uses Python syntax highlighting, via GtkSourceView.
  • Added a Script Library to the Developer menu, for Python code that should be reused (via Import) in several scripts.
  • Added –debug_sql commmand-line option, which prints out the generated SQL commands.

Thanks to Johannes Schmid, Armin Burgmeier, Dodji Seketeli, L Davison, bugzilla, Openismus, and me.

Features planned for Glom 1.6

If they are finished in the next six months:

  • Drag-and-drop layout editing.
  • Relationships Overview.
  • Locking, when multiple users access the same record.
  • Port to libgda 3.0.

More details of the development plans are online.

[1] Ubuntu 6.06 LTS (Dapper) has Glom 1.0, and Ubuntu 6.10 (Edgy) has Glom 1.2. Both should be updated to their latest upstream Glom 1.0.x or 1.2.x versions to fix crashes, but there is still no way for me, a fully-FOSS-compliant software vendor, to deploy bug fix updates to my software on Ubuntu. Using a different .deb repository does not seem to be an acceptable solution.

FOSDEM and the Dreaded Lurgy

I spent the weekend at the FOSDEM conference, an impressively chaotic meeting of diverse software developers. At any one time, there were three talks that I’d like to have seen, and there were so many great people there that I usually got waylaid on the way to talks. All of these people really need to move to Munich.

The GNOME room was a well-organized safe haven. Thanks to Christophe Fergeau and Vincent Untz and GNOME.fr friends. As a GNOME Foundation member, I was entitled to a free T-shirt. It’s the best yet, and actually fits me. It’s a tasteful shade of gray with a small logo, so it can be worn in real life. Conferences normally discriminate against Mediums. For instance, XL was the smallest FOSDEM T-shirt available.

I did a little introductory talk on Glom, which was just an update of my GUADEC talk, and I suspect was very dull. Glom’s a lot more interesting than a bunch of bullet points. Some time I should dedicate a few days to doing some screencasts. Preceding me was the Bling talk by Mirco Müller. When talks are too successful at FOSDEM, the vibrations from the applause trigger the fire alarm. So I had to delay for a few minutes to let people get back into the room. We should maybe alert the authorities before Mirco’s next talk.

I caught some kind of cold on the early morning flight to Brussels, and my voice was almost completely gone by Sunday night. I had planned to spend Monday looking around the town, but instead I went to the airport early in the hope of an early flight back to a warm bed. That didn’t work out, so I shivered on an airport bench for 8 hours. Not being able to speak above a whisper is a really odd experience. It turns out that speaking is really useful.

The are various important things that I need to do, but I’m knocked out for a day or two.

Glom: Relationships Overview

Glom’s relationships overview bounty mostly complete, thanks to Rasmus Toftdahl Olesen, with code checked into Glom.

glom_relationships_overview

 

Hmm, that window title is obviously wrong. I’ll fix that.

We still need to implement right-clicking to edit a table’s relationships from this overview. I’d also like some horizontal lines in the relationship connection lines, where they meet the table rectangles, to more obviously show the indicated key fields. And the arrows need to point both ways when there are relationships in both directions.

Note that 1-to-1, 1-to-many, many-to-many markings are not relevant in Glom, at least for now, because it does not try to enforce these things, though they would be useful extra information for the user to add to the overview.

However, this feature won’t be enabled for the upcoming Glom 1.4, because it depends on GooCanvas which is, quite rightly, taking some more time before it is declared API/ABI stable. This bug report has a patch to enable the feature if you would like to play with the code.

GooCanvas is making great progress, and now is the time to take a look if you are interested in a future gtk/cairo-based canvas API.