info_model.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. """
  2. /***************************************************************************
  3. Name : DB Manager
  4. Description : Database manager plugin for QGIS
  5. Date : May 23, 2011
  6. copyright : (C) 2011 by Giuseppe Sucameli
  7. email : brush.tyler@gmail.com
  8. ***************************************************************************/
  9. /***************************************************************************
  10. * *
  11. * This program is free software; you can redistribute it and/or modify *
  12. * it under the terms of the GNU General Public License as published by *
  13. * the Free Software Foundation; either version 2 of the License, or *
  14. * (at your option) any later version. *
  15. * *
  16. ***************************************************************************/
  17. """
  18. from qgis.PyQt.QtWidgets import QApplication
  19. from ..info_model import DatabaseInfo
  20. from ..html_elems import HtmlTable, HtmlParagraph
  21. class SLDatabaseInfo(DatabaseInfo):
  22. def __init__(self, db):
  23. self.db = db
  24. def connectionDetails(self):
  25. tbl = [
  26. (QApplication.translate("DBManagerPlugin", "Filename:"), self.db.connector.dbname)
  27. ]
  28. return HtmlTable(tbl)
  29. def generalInfo(self):
  30. info = self.db.connector.getInfo()
  31. tbl = [
  32. (QApplication.translate("DBManagerPlugin", "SQLite version:"), info[0])
  33. ]
  34. return HtmlTable(tbl)
  35. def spatialInfo(self):
  36. ret = []
  37. info = self.db.connector.getSpatialInfo()
  38. if info is None:
  39. return
  40. tbl = [
  41. (QApplication.translate("DBManagerPlugin", "Library:"), info[0]),
  42. ("GEOS:", info[1]),
  43. ("Proj:", info[2])
  44. ]
  45. ret.append(HtmlTable(tbl))
  46. if not self.db.connector.has_geometry_columns:
  47. ret.append(HtmlParagraph(
  48. QApplication.translate("DBManagerPlugin", "<warning> geometry_columns table doesn't exist!\n"
  49. "This table is essential for many GIS applications for enumeration of tables.")))
  50. return ret
  51. def privilegesDetails(self):
  52. return None