Sorry for the delay... it's the time, it's the time...<br><br>I used
Eric4 and QtDesigner, so the Pro2MainWindow it's only the window
without the widgets (I only want to test the call), here's the code:<br>
<br>---Pro2MainWindow Code---<br># -*- coding: utf-8 -*-<br><br>"""<br>Module implementing Pro2MainWindow.<br>"""<br><br>from PyQt4.QtGui import QMainWindow<br>from PyQt4.QtCore import pyqtSignature<br>
<br>from Ui_Pro2MainWindow import Ui_Pro2MainWindow<br><br>class Pro2MainWindow(QMainWindow, Ui_Pro2MainWindow):<br> """<br> Class documentation goes here.<br> """<br> def __init__(self, parent = None):<br>
"""<br> Constructor<br> """<br> QMainWindow.__init__(self, parent)<br> self.setupUi(self)<br><br>The setupUi, only call the definitions of the ui generated by QtDesigner, and here's the complete code for the login screen: <br>
# -*- coding: utf-8 -*-<br><br>"""<br>Module implementing DialogPro2Login.<br>"""<br><br>from PyQt4.QtGui import QDialog, QMessageBox, QApplication<br>from PyQt4.QtCore import pyqtSignature<br>
<br>from Ui_Pro2Login import Ui_DialogPro2Login<br>from Pro2MainWindow import Pro2MainWindow<br>from db.database import Pro2db<br><br>import MySQLdb, sys<br><br>class DialogPro2Login(QDialog, Ui_DialogPro2Login):<br> """<br>
Class documentation goes here.<br> """<br> def __init__(self, parent = None):<br> """<br> Constructor<br> """<br> QDialog.__init__(self, parent)<br>
self.setupUi(self)<br> <br> @pyqtSignature("")<div class="Ih2E3d"><br> def on_pushButton_enter_clicked(self):<br> user = self.lineEdit_user.text()<br> passw = self.lineEdit_passw.text()<br>
if user == "" or passw == "":<br>
QMessageBox.information(self, "ERRO", u"Por favor, entre com o usuário e senha.", "OK")<br> else:<br> try:<br></div> p2db = Pro2db(str(user), str(passw)) ### Here is where I want to call the mainwindow ####<br>
wndMain = Pro2MainWindow()<br> wndMain.exec_()<br> wndMain.showMaximized()<br> self.hide()<div class="Ih2E3d"><br>##############################<br> except MySQLdb.Error, error_code:<br>
if error_code[0] == 1045:<br> message = u"Acesso negado para o usuário: %s" %user<br> elif error_code[0] == 2003:<br> message = u"Não foi possível realizar a conexão."<br>
else:<br> message = u"Erro desconhecido.\nCódigo administrativo: %s - %s." %(error_code[0], error_code[1])<br> QMessageBox.information(self, "Falha no acesso", u"O servidor informa:\n%s" %message, "OK")<br>
<br></div> @pyqtSignature("")<br> def on_pushButton_exit_clicked(<div id=":tu" class="ArwC7c ckChnd">self):<br> self.close()<br><br>If you need more info tell me,<br>Thanks for the attention to a so noob problem.<br>
Sandro Dutra - Brazil.</div>