def get_logged_in_user(self): """returns the logged in user """ local_session = LocalSession() from stalker.db.session import DBSession with DBSession.no_autoflush: logged_in_user = local_session.logged_in_user if not logged_in_user: from anima.ui import login_dialog dialog = login_dialog.MainDialog(parent=self) # dialog.deleteLater() dialog.exec_() result = dialog.result() try: # PySide accepted = QtWidgets.QDialog.DialogCode.Accepted except AttributeError: # PyQt4 accepted = QtWidgets.QDialog.Accepted if result == accepted: local_session = LocalSession() logged_in_user = local_session.logged_in_user else: # close the ui # logged_in_user = self.get_logged_in_user() logger.debug("no logged in user") self.close() return logged_in_user
def get_logged_in_user(self): """returns the logged in user """ local_session = LocalSession() logged_in_user = local_session.logged_in_user if not logged_in_user: from anima.ui import login_dialog dialog = login_dialog.MainDialog(parent=self) dialog.exec_() logger.debug("dialog.DialogCode: %s" % dialog.DialogCode) try: # PySide accepted = QtWidgets.QDialog.DialogCode.Accepted except AttributeError: # PyQt4 accepted = QtWidgets.QDialog.Accepted if dialog.DialogCode == accepted: local_session = LocalSession() logged_in_user = local_session.logged_in_user else: # close the ui # logged_in_user = self.get_logged_in_user() logger.debug("no logged in user") self.close() return logged_in_user
def get_logged_in_user(self): """returns the logged in user """ local_session = LocalSession() logged_in_user = local_session.logged_in_user if not logged_in_user: from anima.ui import login_dialog dialog = login_dialog.MainDialog(parent=self) dialog.exec_() logger.debug("dialog.DialogCode: %s" % dialog.DialogCode) try: # PySide accepted = QtGui.QDialog.DialogCode.Accepted except AttributeError: # PyQt4 accepted = QtGui.QDialog.Accepted if dialog.DialogCode == accepted: local_session = LocalSession() logged_in_user = local_session.logged_in_user else: # close the ui # logged_in_user = self.get_logged_in_user() logger.debug("no logged in user") self.close() return logged_in_user