diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-14 19:47:20 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-14 19:47:20 +0000 |
commit | 875ae8e38bc3663e5057ca910e7ebe4b2994edb9 (patch) | |
tree | ddd3b3bc4d6f0343bae986aebbf9555c20f8e558 /python/pyqt/examples3/SQL/sqlcustom1.py | |
parent | cb61a0436524f8ceba31db51ce3f1c5d4afbbb0e (diff) | |
download | tdebindings-875ae8e38bc3663e5057ca910e7ebe4b2994edb9.tar.gz tdebindings-875ae8e38bc3663e5057ca910e7ebe4b2994edb9.zip |
Updated python directory
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1175349 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'python/pyqt/examples3/SQL/sqlcustom1.py')
-rwxr-xr-x | python/pyqt/examples3/SQL/sqlcustom1.py | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/python/pyqt/examples3/SQL/sqlcustom1.py b/python/pyqt/examples3/SQL/sqlcustom1.py deleted file mode 100755 index 46ca5801..00000000 --- a/python/pyqt/examples3/SQL/sqlcustom1.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python - -#**************************************************************************** -#** $Id$ -#** -#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved. -#** -#** This file is part of an example program for PyQt. This example -#** program may be used, distributed and modified without limitation. -#** -#*****************************************************************************/ - -import sys -from qt import * -from qtsql import * - -from dbconnect import createConnection - -TRUE = 1 -FALSE = 0 - -class CustomEdit(QLineEdit): - def __init__(self, parent = None, name = None): - QLineEdit.__init__(self, parent, name) - QObject.connect(self, SIGNAL("textChanged(const QString &)"), - self.changed) - - def changed(self, line): - self.setUpperLine(line) - - def setUpperLine(self, line): - self.upperLineText = line.upper() - self.setText(self.upperLineText) - - -class FormDialog(QDialog): - def __init__(self): - QDialog.__init__(self) - forenameLabel = QLabel("Forename:", self) - forenameEdit = CustomEdit(self) - surnameLabel = QLabel("Surname:", self) - surnameEdit = CustomEdit(self) - salaryLabel = QLabel("Salary:", self) - salaryEdit = QLineEdit(self) - salaryEdit.setAlignment(Qt.AlignRight) - saveButton = QPushButton("&Save", self) - self.connect(saveButton, SIGNAL("clicked()"), self.save) - - grid = QGridLayout(self) - grid.addWidget(forenameLabel, 0, 0) - grid.addWidget(forenameEdit, 0, 1) - grid.addWidget(surnameLabel, 1, 0) - grid.addWidget(surnameEdit, 1, 1) - grid.addWidget(salaryLabel, 2, 0) - grid.addWidget(salaryEdit, 2, 1) - grid.addWidget(saveButton, 3, 0) - grid.activate() - - self.staffCursor = QSqlCursor("staff") - self.staffCursor.setTrimmed("forename", TRUE) - self.staffCursor.setTrimmed("surname", TRUE) - self.idIndex = self.staffCursor.index("id") - self.staffCursor.select(self.idIndex) - self.staffCursor.first() - - self.propMap = QSqlPropertyMap() - self.propMap.insert(forenameEdit.className(), "upperLine") - - self.sqlForm = QSqlForm() - self.sqlForm.setRecord(self.staffCursor.primeUpdate()) - self.sqlForm.installPropertyMap(self.propMap) - self.sqlForm.insert(forenameEdit, "forename") - self.sqlForm.insert(surnameEdit, "surname") - self.sqlForm.insert(salaryEdit, "salary") - self.sqlForm.readFields() - - def save(self): - self.sqlForm.writeFields() - self.staffCursor.update() - self.staffCursor.select(self.idIndex) - self.staffCursor.first() - - -if __name__=='__main__': - app = QApplication( sys.argv ) - - if createConnection(): - formDialog = FormDialog() - formDialog.show() - - app.setMainWidget(formDialog) - app.exec_loop() - - |