Ejemplo n.º 1
0
 def deleteTables(self, explorer, items):
     if not confirmDelete():
         return
     if len(items) > 1:
         explorer.setProgressMaximum(len(items), "Delete tables")
     toUpdate = set()
     for i, item in enumerate(items):
         if not explorer.run(item.element.conn.geodb.delete_table,
                       "Delete PostGIS table",
                       [],
                       item.element.name, item.element.schema):
             break
         #Seems that after deleting the table the db object throws exceptions
         #when running SQL code, until it's refreshed, so we refresh the whole
         #database item instead of just the schema one
         #TODO: improve this workaround
         toUpdate.add(item.parent().parent())
         explorer.setProgress(i+1)
     explorer.resetActivity()
     if len(toUpdate) > 1:
         self.explorer.setProgressMaximum(len(toUpdate), "Refreshing tree")
     for i, item in enumerate(toUpdate):
         item.refreshContent(explorer)
         explorer.setProgress(i+1)
     explorer.resetActivity()
Ejemplo n.º 2
0
 def deleteConnection(self, explorer):
     if not confirmDelete():
         return
     settings = QtCore.QSettings()
     settings.beginGroup("/PostgreSQL/connections/" + self.element.name)
     settings.remove("")
     settings.endGroup()
     self.parent().refreshContent(explorer)
     explorer.setToolbarActions([])
Ejemplo n.º 3
0
 def deleteConnection(self, explorer):
     if not confirmDelete():
         return
     settings = QtCore.QSettings()
     settings.beginGroup("/PostgreSQL/connections/" + self.element.name)
     settings.remove("");
     settings.endGroup();
     self.parent().refreshContent(explorer)
     explorer.setToolbarActions([])
Ejemplo n.º 4
0
 def deleteLayers(self, explorer, items):
     if not confirmDelete():
         return
     explorer.setProgressMaximum(len(items), "Deleting GWC layers")
     toUpdate = set()
     for i, item in enumerate(items):
         explorer.run(item.element.delete, None, [])
         explorer.setProgress(i)
         toUpdate.add(item.parent())
     for item in toUpdate:
         if item is not None:
             item.refreshContent(explorer)
     if None in toUpdate:
         explorer.refreshContent()
     explorer.resetActivity()
     explorer.setDescriptionWidget()
Ejemplo n.º 5
0
 def deleteLayers(self, explorer, items):
     if not confirmDelete():
         return
     explorer.setProgressMaximum(len(items), "Deleting GWC layers")
     toUpdate = set()
     for i, item in enumerate(items):
         explorer.run(item.element.delete,
                  None,
                  [])
         explorer.setProgress(i)
         toUpdate.add(item.parent())
     for item in toUpdate:
         if item is not None:
             item.refreshContent(explorer)
     if None in toUpdate:
         explorer.refreshContent()
     explorer.resetActivity()
     explorer.setDescriptionWidget()
Ejemplo n.º 6
0
 def deleteTables(self, explorer, items):
     if not confirmDelete():
         return
     if len(items) > 1:
         explorer.setProgressMaximum(len(items), "Delete tables")
     toUpdate = set()
     for i, item in enumerate(items):
         if not explorer.run(item.element.conn.geodb.delete_table,
                             "Delete PostGIS table", [], item.element.name,
                             item.element.schema):
             break
         #Seems that after deleting the table the db object throws exceptions
         #when running SQL code, until it's refreshed, so we refresh the whole
         #database item instead of just the schema one
         #TODO: improve this workaround
         toUpdate.add(item.parent().parent())
         explorer.setProgress(i + 1)
     explorer.resetActivity()
     if len(toUpdate) > 1:
         self.explorer.setProgressMaximum(len(toUpdate), "Refreshing tree")
     for i, item in enumerate(toUpdate):
         item.refreshContent(explorer)
         explorer.setProgress(i + 1)
     explorer.resetActivity()
Ejemplo n.º 7
0
 def deleteSchema(self, explorer):
     if confirmDelete():
         explorer.run(self.element.conn.geodb.delete_schema,
                      "Delete schema '" + self.element.name + "'",
                      [self.parent()], self.element.name)
Ejemplo n.º 8
0
 def deleteSchema(self, explorer):
     if confirmDelete():
         explorer.run(self.element.conn.geodb.delete_schema,
                       "Delete schema '" + self.element.name + "'",
                       [self.parent()],
                       self.element.name)