[PyKDE] Custom interface

Eron Lloyd elloyd at lancaster.lib.pa.us
Fri Jan 9 20:53:01 GMT 2004


Hey, thanks! You've definately got the right idea. One of the whole goals this 
widget should be able to support is flexible ballot layout, and Layout 
Managers are probably the way to go. I read in the PyQt book that I can 
create my own types of layout managers:

"It's also quite possible to build a new layoutmanager on QLayout, one, for 
instance, that manages playing cards on a stack, or perhaps items in circle.

You can not only add widgets to layouts; but also layouts. In this way, quite 
complex layouts can achieved with very little pain."

Going in this direction, perhaps the best approach would be to work with 
QGridLayout, which can have items span multiple rows/columns. If that doesn't 
work, I'll look into coding my own.

Because even local elections can have several hundred seats & candidates, 
precise layouts would be work-intensive for each race. What essentially will 
happen is the widget dynamically generating the ballot display based on data 
and rules stored in an XML file. Down the road I'll produce a GUI ballot 
designer that then generates the XML but still lets the widget do all the 
heavy lifting.

This is all very exciting and I'm learning a lot. Thanks for all the help!

Eron

On Friday January 9 2004 12:22 pm, Greg Fortune wrote:
> Here's a 7 minute mockup using Designer.  Making it look pretty is left as
> an exercise to you :O)  Remember, if you need pixel perfect (ie,
> inflexible) layout, that is very possible.  You just lose the ability for
> the app to resize nicely.  The .ui file can be opened in Qt Designer.
>
> All the layout was done using QVBoxLayout and QGridLayout instead of trying
> to pack it into a table or trying to draw the widgets myself on a QCanvas. 
> For custom borders, you might have to derive a QFrame and implement the
> border drawing using that for the "choice" containers.  FYI, QCanvas should
> probably be considered a last resort and only used in a couple places where
> the layouts and the standard widgets don't fit your needs.  Drawing your
> own widgets will be a *lot* more work :)
>
> If you work up something a little closer to what you want, we can probably
> offer advice for tweaking it.
>
> Greg Fortune
> Fortune Solutions
>
> On Friday 09 January 2004 08:22 am, Eron Lloyd wrote:
> > Hi all,
> >
> > I'm working on a major PyQt project implementing a complete open-source
> > election system. One of my major challenges is developing a
> > fully-functional on-screen ballot display widget, to present information
> > to the voter and provide input methods to cast votes. I want the
> > interface to be able to mirror a high-quality paper-ballot as much as
> > possible, and therefore will probably have do extensive custom-widget
> > work. My biggest concern is in the area of ballot layout; ballots usually
> > take on a table-based interface, but I have a much different set of needs
> > than QTable seems to provide. Attached is a mock-up of a sample ballot
> > done in OpenOffice.org using their fantastic table support; this is more
> > along the lines of my requirements, including cell/row spanning, custom
> > borders, background/foreground/border colors, spacing/padding, and input
> > areas. To my knowledge nothing similar to this exists, and I know KWord
> > has been having major difficulties producing a good table class for
> > documents. Any suggestions? I know Qt can probably do it but I'm not
> > expert at all. I see some potential in QCanvas...
> >
> > Thanks!

-- 
Eron Lloyd
Technology Coordinator
Lancaster County Library
elloyd at lancaster.lib.pa.us
Phone: 717-239-2116
Fax: 717-394-3083

---
[This E-mail scanned for viruses by Declude Virus]




More information about the PyQt mailing list