I am writing my first Python app with PyQt4. I have a MainWindow and a Dialog class, which is a part of MainWindow class:
self.loginDialog = LoginDialog();
I checked your code and it looks like the problem is in the way how you're connecting your signal
you emit the signal in Ui_Dialog class
self.emit(QtCore.SIGNAL("aa()"))
you connect to the signal in Ui_MainWindow's setupUi method by calling
QtCore.QObject.connect(self.loginDialog.ui, QtCore.SIGNAL("aa()"), self.login)
notice first parameter is changed to self.loginDialog.ui; your original connect call was using self.loginDialog which is of the LoginDialog type, whereas signal is emitted by the Ui_Dialog class which is ui property of the LoginDialog. After this change login method of the Ui_MainWindow got called
hope this helps, regards