Exemple #1
0
    def configurePlugin(self):
        if Settings.isPluginConfigured():
            prefs = PreferencesDialog(self.iface.mainWindow())
        else:
            prefs = PreferencesWizard(self.iface.mainWindow())

        ok = prefs.exec_() and prefs.preferences().projectsDir().exists()

        if ok:
            Settings.setUserFullName(prefs.preferences().userFullName())
            Settings.setUserInitials(prefs.preferences().userInitials())
            Settings.setUserOrganisation(prefs.preferences().userOrganisation())
            Settings.setProjectsFolder(prefs.preferences().projectsFolder())

            Settings.setServerUrl(prefs.server().url())
            Settings.setServerCredentials(prefs.server().user(), prefs.server().password())

            if prefs.globals().crs().authid():
                Application.setLayerDefaultCrs(prefs.globals().crs())
                Application.setProjectDefaultCrs(prefs.globals().crs())
            if prefs.globals().forceDefaultCrs():
                Application.setForceDefaultCrs()
            if prefs.globals().forceOtfTransform():
                Application.setForceOftTransfom()

            Snapping.setDefaultSnappingTolerance(prefs.globals().snappingTolerance())
            Snapping.setDefaultSnappingUnit(prefs.globals().snappingUnit())

            Application.setComposerFont(prefs.globals().font())

            Settings.setPluginConfigured()

        return ok
Exemple #2
0
    def configure(self):
        # Configure the plugin if required
        if not Settings.isPluginConfigured():
            if not self.configurePlugin():
                return False

        if not Settings.isProjectConfigured():
            self.project().configure()

        if Settings.isProjectConfigured():
            return True

        self.showCriticalMessage('ARK Spatial not configured, unable to continue!')
        self.project().showDock(False)
        return False