[PyKDE] Small database application - best way?

Sibylle Koczian Sibylle.Koczian at t-online.de
Sun Nov 19 14:38:41 GMT 2006


Hello,

I'm trying to migrate a small database application originally written in
Delphi 6.0 to Python. It's for my own use, so it needs a GUI only for
some parts. For these parts I'd like to use PyQt, but at the moment I
don't really see my way.

The first problem I'm trying to solve: The main window contains a
QTableView and some controls. At the start it should be big enough to
show all the data in the view (6-9 rows, 6 columns). I can call
mainwindow.resize(x, y), but I'd prefer to resize the viewport, if
possible depending on the current row count. Calling tableview.resize(x,
y) doesn't help, that still gives a window that only shows part of the
table. What's the right method to use?

Second problem: The QTableView shouldn't be editable. Double clicking on
a record should call a dialog window showing this record, and in this
window some of the fields should be editable. But as far as I can see in
the docs, edit-ability is a property of the model, not of the view.
Anyway, I don't know how to connect a model with controls not inheriting
one of the view classes. On the other hand, I don't think I really plan
something so very unusual.

And, finally: If possible I would prefer not to use the Qt database
plugins, but to keep using the Python database module. Or is that a very
bad idea?

The database is Firebird 1.5.3, OS and distribution Ubuntu 6.10 (with
Gnome as the desktop, but the necessary libraries for PyQt are
installed), database module kinterbasdb 3.2. Everything local on the
same machine.

I've tried and failed to find helpful examples in the documentation, but
of course I may simply have missed them.

Thank you for all hints,
Sibylle





More information about the PyQt mailing list