Beispiel #1
0
 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()     
Beispiel #2
0
 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')