[pygtk] How to write an agenda view?
Martin Drautzburg
Martin.Drautzburg at web.de
Sat Feb 27 15:40:57 WST 2010
Hello all,
I need to write an agenda view, with a timesheet (hours/days) in the
background and with "items" drawn as boxes with text. I dont' quite know
where to start. Here are some specific questions:
(1) Should I use a DrawingArea for the timesheet and draw marks for days,
hours and possibly some lines on it. This seems doable, but I will always
have to convert time-units into pixel units and back when I place anything on
there or when I scroll the sheet. Is there something more elegant?
(2) The timesheet conceptually has infinite size, but only a small part of it
is visible. If I scroll to the next day and I wants smooth scrolling, then
the next day needs to be already "there" before it is fully visible. I was
thinking of having a larger Pixbuf in the background which has an extra "head
day" which is one day ahead of what is visible (and a tail day likewiswe).
Whenever I have scrolled a full day I would have to add another head day to
the pixbuf and I could discard a tail day. Is that the way to do it?
(3) Scrolling the timesheet should be invoked by a mouse gesture. When
scrolling (actually dragging), then the timesheet needs to follow the mouse.
(3.1) Is there built-in support for this, or should I roll my own?
(3.2) The items on the timesheet need to scroll with the timesheet. If they
are simply "drawn" then this would be simple but if they are widgets in their
own right I need to move them all individually, right?
(3.3) If I want more mouse gestures for like "edit", "ok", "zoom in"
and "zoom out", should I just catch the mouse eventy myself, or can I use
someting existing?
(4) How can I do the items. Visually they are just boxes with some text. I
assume it will be tedious to "draw" them on the drawing area, because then I
have to re-implement lots of stuff. What would you do?
(5) Finally the items need to handle overlaps in a semi-clever way, to the
extend that overlapping items need to take only half the space (or a
third ...) so they can be drawn next to each other. I could probably come up
with some packing algorithm, but the whole problem is so close to what
geometry managers do out of the box, I was hoping I could achieve the same
thing with hboxes/vboxes and what else is out there.
How would you guy approach this?
Cheers,
Martin
--
Martin
More information about the pygtk
mailing list