Esempio n. 1
0
    def edit(self):
        if not get_user_email():
            # Note that the get_user_email will display a message box warning 
            # the user to register.
            return

        self.dlg_settings_edit.exec_()
Esempio n. 2
0
    def showEvent(self, event):
        super(DlgSettingsLogin, self).showEvent(event)

        email = get_user_email(warn=False)
        if email:
            self.email.setText(email)
        password = settings.value("MISLAND/password", None)
        if password:
            self.password.setText(password)
Esempio n. 3
0
    def btn_refresh(self):
        self.connectionEvent.emit(True)
        email = get_user_email()
        if email:
            start_date = datetime.datetime.now() + datetime.timedelta(-2)
            jobs = get_execution(date=start_date.strftime('%Y-%m-%d'))
            if jobs:
                self.jobs = jobs
                # Add script names and descriptions to jobs list
                for job in self.jobs:
                    # self.jobs will have prettified data for usage in table,
                    # so save a backup of the original data under key 'raw'
                    job['raw'] = job.copy()
                    script = job.get('script_id', None)
                    if script:
                        job['script_name'] = job['script']['name']
                        # Clean up the script name so the version tag doesn't
                        # look so odd
                        job['script_name'] = re.sub(r'([0-9]+)_([0-9]+)$',
                                                    r'(v\g<1>.\g<2>)',
                                                    job['script_name'])
                        job['script_description'] = job['script'][
                            'description']
                    else:
                        # Handle case of scripts that have been removed or that are
                        # no longer supported
                        job['script_name'] = self.tr('Script not found')
                        job['script_description'] = self.tr('Script not found')

                # Pretty print dates and pull the metadata sent as input params
                for job in self.jobs:
                    job['start_date'] = datetime.datetime.strftime(
                        job['start_date'], '%Y/%m/%d (%H:%M)')
                    job['end_date'] = datetime.datetime.strftime(
                        job['end_date'], '%Y/%m/%d (%H:%M)')
                    job['title'] = job['params'].get('title', '')
                    job['task_name'] = job['params'].get('task_name', '')
                    job['task_notes'] = job['params'].get('task_notes', '')
                    job['params'] = job['params']

                # Cache jobs for later reuse
                self.settings.setValue("MISLAND/jobs_cache", self.jobs)

                self.update_jobs_table()

                self.connectionEvent.emit(False)
                return True
        self.connectionEvent.emit(False)
        return False
Esempio n. 4
0
    def delete(self):
        email = get_user_email()
        if not email:
            return

        reply = QtWidgets.QMessageBox.question(None, self.tr("Delete user?"),
                                           self.tr(u"Are you sure you want to delete the user {}? All of your tasks will be lost and you will no longer be able to process data online using MISLAND.".format(email)),
                                           QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
        if reply == QtWidgets.QMessageBox.Yes:
            resp = delete_user(email)
            if resp:
                QtWidgets.QMessageBox.information(None,
                        self.tr("Success"),
                        QtWidgets.QApplication.translate('LDMPPlugin', u"User {} deleted.".format(email)))
                settings.setValue("MISLAND/password", None)
                settings.setValue("MISLAND/email", None)
                self.close()
                self.ok = True
Esempio n. 5
0
    def showEvent(self, event):
        super(DlgSettingsEditForgotPassword, self).showEvent(event)

        email = get_user_email(warn=False)
        if email:
            self.email.setText(email)