AS if the problem i had yesterday is not enough i have another problem this time its just selecting a simple record from the database. i have this code:
class loginPageView
(QWidget, ui_loginui.
Ui_Mainlogin):
def __init__(self, parent=None):
super(loginPageView, self).__init__(parent)
self.setupUi(self)
self.lineEditer_login.setFocus()
self.connect(self.lineEditer_login, SIGNAL("returnPressed()"), self.sqlEnterlogin)
def sqlEnterlogin(self):
texer = self.lineEditer_login.text()
query.exec_("SELECT staff_id FROM staff WHERE password = pass1") ### %s" % (texer))
if query.next():
self.lineEditer_login.clear()
texer2 = unicode(query.value(STAFF_ID).toString())
self.lineEditer_login.setText("hello are you working? %s" % (texer2))
##self.emit(SIGNAL("loginSuccessful"))
else:
self.lineEditer_login.setText("why are you not working? %s" % (texer3))
class loginPageView(QWidget, ui_loginui.Ui_Mainlogin):
def __init__(self, parent=None):
super(loginPageView, self).__init__(parent)
self.setupUi(self)
self.lineEditer_login.setFocus()
self.connect(self.lineEditer_login, SIGNAL("returnPressed()"), self.sqlEnterlogin)
def sqlEnterlogin(self):
texer = self.lineEditer_login.text()
query = QSqlQuery()
query.exec_("SELECT staff_id FROM staff WHERE password = pass1") ### %s" % (texer))
if query.next():
self.lineEditer_login.clear()
texer2 = unicode(query.value(STAFF_ID).toString())
self.lineEditer_login.setText("hello are you working? %s" % (texer2))
##self.emit(SIGNAL("loginSuccessful"))
else:
texer3 = QSqlQuery().lastError().text()
self.lineEditer_login.setText("why are you not working? %s" % (texer3))
QApplication.processEvents()
To copy to clipboard, switch view to plain text mode
first is the self.lineEditer_login.setFocus() which is conflicting with a QGraphicsView Box on the ui_loginui.py layout page because if i comment out the code for the QGraphicsView Box then the QLineedit box gets focus as soon as the page is executed.
and the second problem is the SQL select wont work for some unexplained weird reason
I've attached all files if some one with some python experience can have a look at please. the script will create and sql lite database and then insert some data into it but it just wont select from it i don't even get an error message as I've tried to set up above to display what the problem is.
Your help on this will be very appreciated, Thanks
Bookmarks