def btn_update_profile(self): if not self.email.text(): QtGui.QMessageBox.critical( None, self.tr("Error"), self.tr("Enter an email address to update."), None) elif not self.password.text(): QtGui.QMessageBox.critical( None, self.tr("Error"), self.tr("Enter your password to update your user details."), None) else: # Validate the email/password by logging in first resp = login(self.email.text(), self.password.text()) if not resp: return user = get_user() if not user: return self.dlg_settingsupdate.email.setText(user['email']) self.dlg_settingsupdate.name.setText(user['name']) self.dlg_settingsupdate.organization.setText(user['institution']) # Add countries, and set index to currently chosen country admin_0 = json.loads(QSettings().value('LDMP/admin_0', None)) self.dlg_settingsupdate.country.addItems(sorted(admin_0.keys())) index = self.dlg_settingsupdate.country.findText(user['country']) if index != -1: self.dlg_settingsupdate.country.setCurrentIndex(index) result = self.dlg_settingsupdate.exec_() if result: self.close()
def btn_login(self): if not self.email.text(): QtGui.QMessageBox.critical(None, self.tr("Error"), self.tr("Enter your email address."), None) self.close() elif not self.email.text(): QtGui.QMessageBox.critical(None, self.tr("Error"), self.tr("Enter your password."), None) self.close() resp = login(self.email.text(), self.password.text()) if resp: mb.pushMessage("Success", "Logged in to the LDMP server as {}.".format( self.email.text()), level=0) self.close()
def login(self): if not self.email.text(): QtWidgets.QMessageBox.critical( None, self.tr("Error"), self.tr("Enter your email address.")) return elif not self.password.text(): QtWidgets.QMessageBox.critical(None, self.tr("Error"), self.tr("Enter your password.")) return resp = login(self.email.text(), self.password.text()) if resp: QtWidgets.QMessageBox.information( None, self.tr("Success"), self.tr(u"Logged in to the Trends.Earth server as {}.").format( self.email.text())) settings.setValue("LDMP/jobs_cache", None) self.done(QtWidgets.QDialog.Accepted) self.ok = True
def btn_login(self): if not self.email.text(): QtGui.QMessageBox.critical(None, self.tr("Error"), self.tr("Enter your email address."), None) return elif not self.password.text(): QtGui.QMessageBox.critical(None, self.tr("Error"), self.tr("Enter your password."), None) return resp = login(self.email.text(), self.password.text()) if resp: mb.pushMessage( self.tr("Success"), self.tr("Logged in to the LDMP server as {}.").format( self.email.text()), level=0) self.settings.setValue("LDMP/jobs_cache", None) self.close()
def login(self): if not self.email.text(): QtWidgets.QMessageBox.critical( None, self.tr("Error"), self.tr("Enter your email address.")) return elif not self.password.text(): QtWidgets.QMessageBox.critical(None, self.tr("Error"), self.tr("Enter your password.")) return resp = login(self.email.text(), self.password.text()) if resp: QtWidgets.QMessageBox.information( None, self.tr("Success"), self. tr(u"""Logged in to the Trends.Earth server as {}.<html><p>Welcome to Trends.Earth!<p/><p> <a href= 'https://groups.google.com/forum/#!forum/trends_earth_users/join'>Join the Trends.Earth Users google groups<a/></p><p> Make sure to join the google groups for the Trends.Earth users to keep up with updates and Q&A about the tool, methods, and datasets in support of Sustainable Development Goals monitoring.</p>""" ).format(self.email.text())) settings.setValue("LDMP/jobs_cache", None) self.done(QtWidgets.QDialog.Accepted) self.ok = True