Example #1
0
                             headers={'content-Type': 'application/json'},
                             json=self.__config)
            if r.status_code != 200:
                QgsMessageLog.logMessage(
                    "attempting to save new configuration, the server request returned code {}"
                    .format(r.status_code),
                    'QWC2 Plugin',
                    level=Qgis.Critical)
                self.warningLabel.setText(
                    "attempting to save the config, the server request returned code {}"
                    .format(r.status_code))
                return
            else:
                QgsMessageLog.logMessage("New configuration has been saved",
                                         'QWC2 Plugin',
                                         level=Qgis.Success)

        super(ConfigDialog, self).accept()


if __name__ == "__main__":
    from qgis.core import QgsApplication
    import sys
    a = QgsApplication([], False)
    a.initQgis()

    d = ConfigDialog(sys.argv[1] if len(sys.argv) >= 2 else None)

    d.show()
    a.exec()