I have a QDialog which is a login window. When the login is successful, I would like to open my MainWindow from QMainWindow class. I have herited my QMainWidnow from a UI_file generated with QtDesigner.
To be more specific, I have the following:
login.py:
from PyQt4 import QtCore, QtGui
from main import ciras_main
class Ui_Dialog(object):
def setupUi(self, Dialog):
....
def retranslateUi(self, Dialog):
....
def welcomeWindowShow(self, username):
self.welcomeWindow = QtGui.QMainWindow()
self.ui = ciras_main(username)
self.ui.setupUi(self.welcomeWindow, username)
self.welcomeWindow.show()
ui_main.py:
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(self, MainWindow, username):
...
def retranslateUi(self, MainWindow):
...
and my main class herited from ui_main.py
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog
from ui_main import *
class ciras_main(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self,username, parent=None):
super(ciras_main, self).__init__(parent)
self.setupUi(self, username)
self.comboBox.activated.connect(self.selectProject)
...
def selectProject(self):
...
The problem is the following. When login is successful, function welcomeWindowShow() is called to open my Mainwindow from class ciras_main. However, it seems it only loads ui_main.py because the function "selectProject" for example (when i change my combobox) does not execute anything. However, If I execute my mainwindow without passing by login.py, everything works. I think my problem is to connect the welcomeWindowShow() function to open my mainwindow.
Any idea about why it s not working? Thank you very much