summaryrefslogtreecommitdiffstats
path: root/examples3/SQL/sqlcustom1.py
diff options
context:
space:
mode:
authoraneejit1 <aneejit1@gmail.com>2022-07-28 15:46:19 +0000
committeraneejit1 <aneejit1@gmail.com>2022-07-30 17:54:15 +0000
commite602246539fd7435aaeb440fcb7f852c92c8426b (patch)
tree35e09f5d93c67158e6c1160d6d9b27ae8a0bf966 /examples3/SQL/sqlcustom1.py
parentb34531364d5c0d3be7056d87011afd8bd538a0e7 (diff)
downloadpytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.tar.gz
pytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.zip
Remove Qt V2 support and example files
Build files for pyuic2 have been removed along with the examples for version 2 of Qt and the build/configure scripts have been amended accordingly. The "examples3" directory has been renamed to just "examples". Signed-off-by: aneejit1 <aneejit1@gmail.com>
Diffstat (limited to 'examples3/SQL/sqlcustom1.py')
-rwxr-xr-xexamples3/SQL/sqlcustom1.py94
1 files changed, 0 insertions, 94 deletions
diff --git a/examples3/SQL/sqlcustom1.py b/examples3/SQL/sqlcustom1.py
deleted file mode 100755
index 4da8f8a..0000000
--- a/examples3/SQL/sqlcustom1.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env python
-
-#****************************************************************************
-#** $Id: sqlcustom1.py,v 1.3 2002/07/06 13:35:41 phil Exp $
-#**
-#** Copyright (C) 1992-1998 Troll Tech AS. All rights reserved.
-#**
-#** This file is part of an example program for PyTQt. This example
-#** program may be used, distributed and modified without limitation.
-#**
-#*****************************************************************************/
-
-import sys
-from python_tqt.qt import *
-from python_tqt.qtsql import *
-
-from dbconnect import createConnection
-
-TRUE = 1
-FALSE = 0
-
-class CustomEdit(TQLineEdit):
- def __init__(self, parent = None, name = None):
- TQLineEdit.__init__(self, parent, name)
- TQObject.connect(self, SIGNAL("textChanged(const TQString &)"),
- self.changed)
-
- def changed(self, line):
- self.setUpperLine(line)
-
- def setUpperLine(self, line):
- self.upperLineText = line.upper()
- self.setText(self.upperLineText)
-
-
-class FormDialog(TQDialog):
- def __init__(self):
- TQDialog.__init__(self)
- forenameLabel = TQLabel("Forename:", self)
- forenameEdit = CustomEdit(self)
- surnameLabel = TQLabel("Surname:", self)
- surnameEdit = CustomEdit(self)
- salaryLabel = TQLabel("Salary:", self)
- salaryEdit = TQLineEdit(self)
- salaryEdit.setAlignment(TQt.AlignRight)
- saveButton = TQPushButton("&Save", self)
- self.connect(saveButton, SIGNAL("clicked()"), self.save)
-
- grid = TQGridLayout(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 = TQSqlCursor("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 = TQSqlPropertyMap()
- self.propMap.insert(forenameEdit.className(), "upperLine")
-
- self.sqlForm = TQSqlForm()
- 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 = TQApplication( sys.argv )
-
- if createConnection():
- formDialog = FormDialog()
- formDialog.show()
-
- app.setMainWidget(formDialog)
- app.exec_loop()
-
-