Example #1
0
    def publishPgTable(self, tree, explorer):
        if not xmlNameIsValid(self.element.name, xmlNameRegex()):
            QtGui.QMessageBox.warning(
                explorer, "Invalid name",
                ("The table name (%s) is not a valid XML name.\n" +
                 "This could cause problems when published to GeoServer.\n" +
                 "Please rename it and retry publishing.") % self.element.name)
            return
        dlg = PublishLayerDialog(explorer.catalogs(), self.element)
        dlg.exec_()
        if dlg.catalog is None:
            return
        cat = dlg.catalog
        catItem = tree.findFirstItem(cat)
        toUpdate = [catItem]
        if int(self.element.srid) == 0:
            explorer.setWarning("PostGIS table '{0}' has no SRID; ESPG:4326 "
                                "will be assigned.".format(self.element.name))
        if explorer.run(publishTable,
                        "Publish table '" + self.element.name + "'", toUpdate,
                        self.element, cat, dlg.workspace, True, dlg.layername):

            # add existing style to layer, or later some operations may fail,
            # like malformed XML when getting capabilities for OWS connections
            pglyr = cat.get_layer(dlg.layername)
            pgitem = tree.findFirstItem(pglyr)
            if pgitem is None:
                return
            if not pgitem.addStyleToLayer(explorer):  # handles refresh of item
                # user cancelled AddStyleToLayerDialog
                noDefaultStyleError(explorer, dlg.layername)
            else:
                catItem.layersItem.refreshContent(explorer)
    def publishPgTable(self, tree, explorer):
        if not xmlNameIsValid(self.element.name, xmlNameRegex()):
            QtGui.QMessageBox.warning(explorer, "Invalid name",
                                      ("The table name (%s) is not a valid XML name.\n"
                                      + "This could cause problems when published to GeoServer.\n"
                                      + "Please rename it and retry publishing.") % self.element.name)
            return
        dlg = PublishLayerDialog(explorer.catalogs(), self.element)
        dlg.exec_()
        if dlg.catalog is None:
            return
        cat = dlg.catalog
        catItem = tree.findFirstItem(cat)
        toUpdate = [catItem]
        if int(self.element.srid) == 0:
            explorer.setWarning("PostGIS table '{0}' has no SRID; ESPG:4326 "
                                "will be assigned.".format(self.element.name))
        if explorer.run(publishTable,
                        "Publish table '" + self.element.name + "'",
                        toUpdate,
                        self.element, cat, dlg.workspace, True, dlg.layername):

            # add existing style to layer, or later some operations may fail,
            # like malformed XML when getting capabilities for OWS connections
            pglyr = cat.get_layer(dlg.layername)
            pgitem = tree.findFirstItem(pglyr)
            if pgitem is None:
                return
            if not pgitem.addStyleToLayer(explorer):  # handles refresh of item
                # user cancelled AddStyleToLayerDialog
                noDefaultStyleError(explorer, dlg.layername)
            else:
                catItem.layersItem.refreshContent(explorer)
 def publishPgTable(self, tree, explorer):
     dlg = PublishLayerDialog(explorer.catalogs())
     dlg.exec_()
     if dlg.catalog is None:
         return
     cat = dlg.catalog
     catItem = tree.findAllItems(cat)[0]
     toUpdate = [catItem]
     explorer.run(publishTable, "Publish table '" + self.element.name + "'",
                  toUpdate, self.element, cat, dlg.workspace)
Example #4
0
 def publishLayer(self, tree, explorer):
     dlg = PublishLayerDialog(explorer.catalogs())
     dlg.exec_()
     if dlg.catalog is None:
         return
     cat = dlg.catalog
     ogcat = OGCatalog(cat)
     catItem = tree.findAllItems(cat)[0]
     explorer.run(publishLayer,
                  "Publish layer '" + self.element.name() + "'", [catItem],
                  ogcat, self.element, dlg.workspace, True)
Example #5
0
 def createStoreFromLayer(self, tree, explorer):
     dlg = PublishLayerDialog(explorer.catalogs())
     dlg.exec_()
     if dlg.catalog is None:
         return
     cat = dlg.catalog
     ogcat = OGCatalog(cat)
     catItem = tree.findAllItems(cat)[0]
     toUpdate = [catItem]
     explorer.run(ogcat.createStore,
                  "Create store from layer '" + self.element.name() + "'",
                  toUpdate, self.element, dlg.workspace, True)
 def publishPgTable(self, tree, explorer):
     dlg = PublishLayerDialog(explorer.catalogs())
     dlg.exec_()      
     if dlg.catalog is None:
         return
     cat = dlg.catalog          
     catItem = tree.findAllItems(cat)[0]
     toUpdate = [catItem]                    
     explorer.run(self._publishTable,
              "Publish table '" + self.element.name + "'",
              toUpdate,
              self.element, cat, dlg.workspace)
 def publishLayer(self, tree, explorer):
     dlg = PublishLayerDialog(explorer.catalogs())
     dlg.exec_()      
     if dlg.catalog is None:
         return
     cat = dlg.catalog  
     ogcat = OGCatalog(cat)
     catItem = tree.findAllItems(cat)[0]                            
     explorer.run(publishLayer,
              "Publish layer '" + self.element.name() + "'",
              [catItem],
              ogcat, self.element, dlg.workspace, True)
 def createStoreFromLayer(self, tree, explorer):
     dlg = PublishLayerDialog(explorer.catalogs(), self.element)
     dlg.exec_()
     if dlg.catalog is None:
         return
     cat = dlg.catalog
     ogcat = OGCatalog(cat)
     catItem = tree.findAllItems(cat)[0]
     explorer.run(ogcat.upload,
              "Create store from layer '" + self.element.name() + "'",
              [catItem],
              self.element, dlg.workspace, True, dlg.layername)