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