def __init__(self, repo):            
     self.diffs = repo.notindatabase();
     self.isDirty = len(self.diffs) > 0 
     text = "Working Tree [NOT CLEAN]" if self.isDirty else "Working Tree"  
     icon = worktreeUncleanIcon if self.isDirty else worktreeCleanIcon                     
     TreeItem.__init__(self, repo, icon, text)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)
Ejemplo n.º 2
0
 def __init__(self, layer ):
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/layer.png")
     TreeItem.__init__(self, layer, icon)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDragEnabled)
     if layer is not None and hasattr(layer, 'name') \
             and hasattr(layer, 'publicSource'):
         self.setToolTip(0, "{0}:\n{1}".format(layer.name(),
             layer.publicSource()))
Ejemplo n.º 3
0
 def linkClicked(self, tree, explorer, url):
     TreeItem.linkClicked(self, tree, explorer, url)
     if url.toString() == 'kill':
         try:
             self.element.killSeedingTasks()
         except FailedRequestError:
             #TODO:
             return
     try:
         text = self.getDescriptionHtml(tree, explorer)
         self.description.setHtml(text)
     except:
         explorer.setDescriptionWidget()
Ejemplo n.º 4
0
 def linkClicked(self, tree, explorer, url):
     TreeItem.linkClicked(self,tree, explorer, url)
     if url.toString() == 'kill':
         try:
             self.element.killSeedingTasks()
         except FailedRequestError:
             #TODO:
             return
     try:
         text = self.getDescriptionHtml(tree, explorer)
         self.description.setHtml(text)
     except:
         explorer.setDescriptionWidget()
 def _getDescriptionHtml(self, tree, explorer):  
     if not self.element.isValid:            
         html = ('<p>Cannot connect to this database. This might be caused by missing user/passwd credentials.'
                 'Try <a href="refresh">refreshing</a> the connection, to enter new credentials and retry to connect</p>')     
         return html
     else:
         return TreeItem._getDescriptionHtml(self, tree, explorer)
Ejemplo n.º 6
0
 def _getDescriptionHtml(self, tree, explorer):  
     if not self.element.isValid:
         html = u'<div style="background-color:#ffffcc;"><h1>&nbsp; ' + self.text(0) + ' (GWC layer)</h1></div></br>'  
         html += ('<p>Cannot connect to this database. This might be caused by missing user/passwd credentials.'
                 'Try <a href="refresh">refreshing</a> the connection, to enter new credentials and retry to connect</p>')     
         return html
     else:
         return TreeItem._getDescriptionHtml(self, tree, explorer)
Ejemplo n.º 7
0
 def _getDescriptionHtml(self, tree, explorer):
     if not self.element.isValid:
         html = (
             '<p>Cannot connect to this database. This might be caused by missing user/passwd credentials.'
             'Try <a href="refresh">refreshing</a> the connection, to enter new credentials and retry to connect</p>'
         )
         return html
     else:
         return TreeItem._getDescriptionHtml(self, tree, explorer)
Ejemplo n.º 8
0
    def _getDescriptionHtml(self, tree, explorer):
        if not self.element.isValid:
            html = ""
            typesok, typesmsg = self._checkAllSelectionTypes(self, tree)
            if not typesok:
                return typesmsg
            else:
                html += typesmsg

            items = tree.selectedItems()
            # don't show if multiple items selected, but not the current item
            if not items or self in items or len(items) == 1:
                html += ('<p>Cannot connect to this database. This might be caused by missing user/passwd credentials.'
                        'Try <a href="refresh">refreshing</a> the connection, to enter new credentials and retry to connect</p>')
            return html
        else:
            return TreeItem._getDescriptionHtml(self, tree, explorer)
Ejemplo n.º 9
0
    def _getDescriptionHtml(self, tree, explorer):
        if not self.element.isValid:
            html = ""
            typesok, typesmsg = self._checkAllSelectionTypes(self, tree)
            if not typesok:
                return typesmsg
            else:
                html += typesmsg

            items = tree.selectedItems()
            # don't show if multiple items selected, but not the current item
            if not items or self in items or len(items) == 1:
                html += (
                    '<p>Cannot connect to this database. This might be caused by missing user/passwd credentials.'
                    'Try <a href="refresh">refreshing</a> the connection, to enter new credentials and retry to connect</p>'
                )
            return html
        else:
            return TreeItem._getDescriptionHtml(self, tree, explorer)
Ejemplo n.º 10
0
 def __init__(self, layer): 
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/style.png")
     TreeItem.__init__(self, layer, icon, "Style of layer '" + layer.name() + "'") 
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDragEnabled)
Ejemplo n.º 11
0
 def __init__(self, catalog):
     self.catalog = catalog
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/gwc.png")
     TreeItem.__init__(self, None, icon, "GeoWebCache Layers")
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDropEnabled)
Ejemplo n.º 12
0
 def populate(self):                    
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/layer.png")
     layersItem = TreeItem(None, icon, "QGIS Layers")        
     layersItem.setIcon(0, icon)
     layers = qgislayers.getAllLayers()
     for layer in layers:
         layerItem = QgsLayerItem(layer)            
         layersItem.addChild(layerItem)
     self.addChild(layersItem)
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/group.gif")
     groupsItem = TreeItem(None, icon, "QGIS Groups")        
     groups = qgislayers.getGroups()
     for group in groups:
         groupItem = QgsGroupItem(group)                                
         groupsItem.addChild(groupItem)
         groupItem.populate()
     self.addChild(groupsItem)
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/style.png")
     stylesItem = TreeItem(None, icon, "QGIS Styles")               
     stylesItem.setIcon(0, icon)
     styles = qgislayers.getVectorLayers()
     for style in styles:
         styleItem = QgsStyleItem(style)            
         stylesItem.addChild(styleItem)
     self.addChild(stylesItem)        
Ejemplo n.º 13
0
 def __init__(self, group): 
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/group.gif")
     TreeItem.__init__(self, group , icon)   
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDragEnabled)
Ejemplo n.º 14
0
 def __init__(self):
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/style.png")
     TreeItem.__init__(self, None, icon, "QGIS Styles")
Ejemplo n.º 15
0
 def __init__(self): 
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/qgis.png")
     TreeItem.__init__(self, None, icon, "QGIS project")        
Ejemplo n.º 16
0
 def __init__(self, schema):
     pgIcon = QtGui.QIcon(
         os.path.dirname(__file__) + "/../images/namespace.png")
     TreeItem.__init__(self, schema, pgIcon)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                   | QtCore.Qt.ItemIsDropEnabled)
Ejemplo n.º 17
0
 def __init__(self, table):
     TreeItem.__init__(self, table, self.getIcon(table))
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                   | QtCore.Qt.ItemIsDragEnabled)
Ejemplo n.º 18
0
 def __init__(self):
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/qgis.png")
     TreeItem.__init__(self, None, icon, "QGIS project")
 def __init__(self):   
     self.repos = {}          
     TreeItem.__init__(self, None, geogitIcon, "Geogit repositories") 
Ejemplo n.º 20
0
 def __init__(self, layer):
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/style.png")
     TreeItem.__init__(self, layer, icon,
                       "Style of layer '" + layer.name() + "'")
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                   | QtCore.Qt.ItemIsDragEnabled)
Ejemplo n.º 21
0
 def __init__(self, layer):
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/layer.png")
     TreeItem.__init__(self, layer, icon)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                   | QtCore.Qt.ItemIsDropEnabled)
Ejemplo n.º 22
0
 def __init__(self, catalog):
     self.catalog = catalog
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/gwc.png")
     TreeItem.__init__(self, None, icon, "GeoWebCache Layers")
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                   | QtCore.Qt.ItemIsDropEnabled)
 def __init__(self, entry):                            
     TreeItem.__init__(self, entry, commitIcon, entry.commit.message)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable) 
 def __init__(self, tree):                            
     TreeItem.__init__(self, tree, treeIcon, tree.path)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable)  
Ejemplo n.º 25
0
 def __init__(self, group):
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/group.gif")
     TreeItem.__init__(self, group, icon)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                   | QtCore.Qt.ItemIsDragEnabled)
 def __init__(self, repo, name):                      
     TreeItem.__init__(self, repo, repoIcon, name)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDropEnabled)          
Ejemplo n.º 27
0
 def linkClicked(self, tree, explorer, url):
     if not self.element.isValid:
         self.refreshContent(explorer)
     else:
         TreeItem.linkClicked(self, tree, explorer, url)        
Ejemplo n.º 28
0
 def __init__(self):             
     TreeItem.__init__(self, None, pgIcon, "PostGIS connections")
     self.databases = [] 
Ejemplo n.º 29
0
 def __init__(self, layer):
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/layer.png")
     TreeItem.__init__(self, layer, icon)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDropEnabled)
Ejemplo n.º 30
0
 def __init__(self, schema): 
     pgIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/namespace.png")                        
     TreeItem.__init__(self, schema, pgIcon)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDropEnabled)
Ejemplo n.º 31
0
 def linkClicked(self, tree, explorer, url):
     if not self.element.isValid:
         self.refreshContent(explorer)
     else:
         TreeItem.linkClicked(self, tree, explorer, url)
Ejemplo n.º 32
0
 def __init__(self, table):                               
     TreeItem.__init__(self, table, self.getIcon(table))
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDragEnabled)
Ejemplo n.º 33
0
 def __init__(self):
     TreeItem.__init__(self, None, pgIcon, "PostGIS Connections")
     self.databases = []
Ejemplo n.º 34
0
 def __init__(self, conn):                      
     TreeItem.__init__(self, conn, pgIcon)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDropEnabled)          
Ejemplo n.º 35
0
 def __init__(self, conn):
     TreeItem.__init__(self, conn, pgIcon)
     self.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
                   | QtCore.Qt.ItemIsDropEnabled)
Ejemplo n.º 36
0
 def __init__(self):
     icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/group.gif")
     TreeItem.__init__(self, None, icon, "QGIS Groups")