def __init__(self, explorer): QtGui.QWidget.__init__(self, None) self.explorer = explorer self.connectionsItem = PgConnectionsItem() self.connection = None verticalLayout = QtGui.QVBoxLayout() verticalLayout.setSpacing(2) verticalLayout.setMargin(0) horizontalLayout = QtGui.QHBoxLayout() horizontalLayout.setSpacing(2) horizontalLayout.setMargin(0) self.comboBox = QtGui.QComboBox() self.comboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.comboBox.currentIndexChanged.connect(self.connectionHasChanged) horizontalLayout.addWidget(self.comboBox) self.addButton = QtGui.QPushButton() self.addButton.clicked.connect(lambda: self.addConnection(explorer)) addIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/add.png") self.addButton.setIcon(addIcon) self.addButton.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) self.refreshButton = QtGui.QPushButton() self.refreshButton.clicked.connect(self.refreshContent) refreshIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/refresh.png") self.refreshButton.setIcon(refreshIcon) self.refreshButton.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) horizontalLayout.addWidget(self.refreshButton) horizontalLayout.addWidget(self.addButton) verticalLayout.addLayout(horizontalLayout) self.tree = ExplorerTreeWidget(self.explorer) verticalLayout.addWidget(self.tree) self.setLayout(verticalLayout) self.populateComboBox() if self.connection is not None and self.connection.isValid: self.refreshContent()
def fillData(self): if self.singletab: self.gsItem = GsCatalogsItem() self.pgItem = PgConnectionsItem() self.pgItem.populate() self.qgsItem = QgsProjectItem() self.qgsItem.populate() self.tree.addTopLevelItem(self.gsItem) self.tree.addTopLevelItem(self.pgItem) geogitActive = QSettings().value("/OpenGeo/Settings/GeoGit/Active", defaultValue=False,) geogitActive = str(geogitActive).lower() == 'true' if geogitActive: self.geogitItem = GeogitRepositoriesItem() self.tree.addTopLevelItem(self.geogitItem) self.tree.addTopLevelItem(self.qgsItem) else: gsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/geoserver.png") pgIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/pg.png") qgsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/qgis.png") self.gsPanel = GsTreePanel(self.explorer) self.qgsPanel = QgsTreePanel(self.explorer) self.pgPanel = PgTreePanel(self.explorer) self.tabbedPanel.addTab(self.gsPanel, gsIcon, 'GeoServer') self.tabbedPanel.addTab(self.pgPanel, pgIcon,'PostGIS') self.tabbedPanel.addTab(self.qgsPanel, qgsIcon, 'QGIS')
def fillData(self): if self.singletab: self.gsItem = GsCatalogsItem() self.pgItem = PgConnectionsItem() self.pgItem.populate() self.qgsItem = QgsProjectItem() self.qgsItem.populate() self.tree.addTopLevelItem(self.gsItem) self.tree.addTopLevelItem(self.pgItem) self.tree.addTopLevelItem(self.qgsItem) else: gsIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/geoserver.png") pgIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/postgis.png") qgsIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/qgis.png") self.gsPanel = GsTreePanel(self.explorer) self.qgsPanel = QgsTreePanel(self.explorer) self.pgPanel = PgTreePanel(self.explorer) self.tabbedPanel.addTab(self.gsPanel, gsIcon, 'GeoServer') self.tabbedPanel.addTab(self.pgPanel, pgIcon, 'PostGIS') self.tabbedPanel.addTab(self.qgsPanel, qgsIcon, 'QGIS')
def fillData(self): if self.singletab: self.gsItem = GsCatalogsItem() self.pgItem = PgConnectionsItem() self.pgItem.populate() self.qgsItem = QgsProjectItem() self.qgsItem.populate() self.tree.addTopLevelItem(self.gsItem) self.tree.addTopLevelItem(self.pgItem) self.tree.addTopLevelItem(self.qgsItem) else: gsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/geoserver.png") pgIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/postgis.png") qgsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/qgis.png") self.gsPanel = GsTreePanel(self.explorer) self.qgsPanel = QgsTreePanel(self.explorer) self.pgPanel = PgTreePanel(self.explorer) self.tabbedPanel.addTab(self.gsPanel, gsIcon, 'GeoServer') self.tabbedPanel.addTab(self.pgPanel, pgIcon,'PostGIS') self.tabbedPanel.addTab(self.qgsPanel, qgsIcon, 'QGIS')
class ExplorerWidget(QtGui.QWidget): def __init__(self, explorer, singletab = False): self.explorer = explorer self.singletab = singletab QtGui.QWidget.__init__(self, None) self.qgsItem = None verticalLayout = QtGui.QVBoxLayout() verticalLayout.setSpacing(2) verticalLayout.setMargin(0) if singletab: self.tree = ExplorerTreeWidget(explorer) verticalLayout.addWidget(self.tree) else: self.tabbedPanel = QtGui.QTabWidget() self.tabbedPanel.setVisible(True) verticalLayout.addWidget(self.tabbedPanel) #self.toolbar = QtGui.QToolBar() #self.toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly) self.setLayout(verticalLayout) self.fillData() def fillData(self): if self.singletab: self.gsItem = GsCatalogsItem() self.pgItem = PgConnectionsItem() self.pgItem.populate() self.qgsItem = QgsProjectItem() self.qgsItem.populate() self.tree.addTopLevelItem(self.gsItem) self.tree.addTopLevelItem(self.pgItem) geogitActive = QSettings().value("/OpenGeo/Settings/GeoGit/Active", defaultValue=False,) geogitActive = str(geogitActive).lower() == 'true' if geogitActive: self.geogitItem = GeogitRepositoriesItem() self.tree.addTopLevelItem(self.geogitItem) self.tree.addTopLevelItem(self.qgsItem) else: gsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/geoserver.png") pgIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/pg.png") qgsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/qgis.png") self.gsPanel = GsTreePanel(self.explorer) self.qgsPanel = QgsTreePanel(self.explorer) self.pgPanel = PgTreePanel(self.explorer) self.tabbedPanel.addTab(self.gsPanel, gsIcon, 'GeoServer') self.tabbedPanel.addTab(self.pgPanel, pgIcon,'PostGIS') self.tabbedPanel.addTab(self.qgsPanel, qgsIcon, 'QGIS') def catalogs(self): if self.singletab: return self.gsItem._catalogs else: return self.gsPanel.catalogs def geogitRepositories(self): if self.singletab: return self.geogitItem.repos else: return self.geogitPanel.repos def pgDatabases(self): if self.singletab: return self.pgItem.databases else: return self.pgPanel.databases() def currentTreeWidget(self): if self.singletab: return self.tree else: return self.tabbedPanel.currentWidget() def currentTree(self): if self.singletab: return self.tree else: return self.tabbedPanel.currentWidget().tree def updateQgisContent(self): if self.singletab: self.qgsItem.refreshContent(self.explorer) else: self.qgsPanel.refreshContent() def refreshContent(self): tree = self.currentTreeWidget() if tree is not None: tree.refreshContent()
class ExplorerWidget(QtGui.QWidget): def __init__(self, explorer, singletab = False): self.explorer = explorer self.singletab = singletab QtGui.QWidget.__init__(self, None) self.qgsItem = None verticalLayout = QtGui.QVBoxLayout() verticalLayout.setSpacing(2) verticalLayout.setMargin(0) if singletab: self.tree = ExplorerTreeWidget(explorer) verticalLayout.addWidget(self.tree) else: self.tabbedPanel = QtGui.QTabWidget() self.tabbedPanel.setVisible(True) verticalLayout.addWidget(self.tabbedPanel) self.setLayout(verticalLayout) self.fillData() def fillData(self): if self.singletab: self.gsItem = GsCatalogsItem() self.pgItem = PgConnectionsItem() self.pgItem.populate() self.qgsItem = QgsProjectItem() self.qgsItem.populate() self.tree.addTopLevelItem(self.gsItem) self.tree.addTopLevelItem(self.pgItem) self.tree.addTopLevelItem(self.qgsItem) else: gsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/geoserver.png") pgIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/postgis.png") qgsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/qgis.png") self.gsPanel = GsTreePanel(self.explorer) self.qgsPanel = QgsTreePanel(self.explorer) self.pgPanel = PgTreePanel(self.explorer) self.tabbedPanel.addTab(self.gsPanel, gsIcon, 'GeoServer') self.tabbedPanel.addTab(self.pgPanel, pgIcon,'PostGIS') self.tabbedPanel.addTab(self.qgsPanel, qgsIcon, 'QGIS') def catalogs(self): if self.singletab: return self.gsItem._catalogs else: return self.gsPanel.catalogs def pgDatabases(self): if self.singletab: return self.pgItem.databases else: return self.pgPanel.databases() def currentTreeWidget(self): if self.singletab: return self.tree else: return self.tabbedPanel.currentWidget() def currentTree(self): if self.singletab: return self.tree else: return self.tabbedPanel.currentWidget().tree def updateQgisContent(self): if self.singletab: self.qgsItem.refreshContent(self.explorer) else: self.qgsPanel.refreshContent() def refreshContent(self): tree = self.currentTreeWidget() if tree is not None: tree.refreshContent()
class ExplorerWidget(QtGui.QWidget): def __init__(self, explorer, singletab=False): self.explorer = explorer self.singletab = singletab QtGui.QWidget.__init__(self, None) self.qgsItem = None verticalLayout = QtGui.QVBoxLayout() verticalLayout.setSpacing(2) verticalLayout.setMargin(0) if singletab: self.tree = ExplorerTreeWidget(explorer) verticalLayout.addWidget(self.tree) else: self.tabbedPanel = QtGui.QTabWidget() self.tabbedPanel.setVisible(True) verticalLayout.addWidget(self.tabbedPanel) self.setLayout(verticalLayout) self.fillData() def fillData(self): if self.singletab: self.gsItem = GsCatalogsItem() self.pgItem = PgConnectionsItem() self.pgItem.populate() self.qgsItem = QgsProjectItem() self.qgsItem.populate() self.tree.addTopLevelItem(self.gsItem) self.tree.addTopLevelItem(self.pgItem) self.tree.addTopLevelItem(self.qgsItem) else: gsIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/geoserver.png") pgIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/postgis.png") qgsIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/qgis.png") self.gsPanel = GsTreePanel(self.explorer) self.qgsPanel = QgsTreePanel(self.explorer) self.pgPanel = PgTreePanel(self.explorer) self.tabbedPanel.addTab(self.gsPanel, gsIcon, 'GeoServer') self.tabbedPanel.addTab(self.pgPanel, pgIcon, 'PostGIS') self.tabbedPanel.addTab(self.qgsPanel, qgsIcon, 'QGIS') def catalogs(self): if self.singletab: return self.gsItem._catalogs else: return self.gsPanel.catalogs def pgDatabases(self): if self.singletab: return self.pgItem.databases else: return self.pgPanel.databases() def currentTreeWidget(self): if self.singletab: return self.tree else: return self.tabbedPanel.currentWidget() def currentTree(self): if self.singletab: return self.tree else: return self.tabbedPanel.currentWidget().tree def updateQgisContent(self): if self.singletab: self.qgsItem.refreshContent(self.explorer) else: self.qgsPanel.refreshContent() def refreshContent(self): tree = self.currentTreeWidget() if tree is not None: tree.refreshContent()