Example #1
0
def changeSource(source, **data):
    oldData = {
        attr: getattr(source, attr)
        for attr in ('name', 'path', 'domain', 'extensions', 'enabled')
    }
    stack.push(translate('filesystem', "Change source"),
               stack.Call(_changeSource, source, data),
               stack.Call(_changeSource, source, oldData))
Example #2
0
 def removeFromDb(self, elements):
     """Remove the given elements with all their tags etc. from the database. Containers are also
     removed from the real level. No element may be contained in any container unless this container
     is also in *elements*.
     """
     if len(elements):
         stack.push(self.tr("Remove elements from database"),
                    stack.Call(self._removeFromDb, elements),
                    stack.Call(self._addToDb, elements))
Example #3
0
 def addToDb(self, elements):
     """Add the given elements to the database including their tags, flags, stickers and contents.
     Remarks:
     
         - element.level must be this level,
         - files must already be loaded on real, containers must not,
         - this method will not change the elements but assume that in particular their parent-lists
           are correct (on the real level).
     
     """
     if len(elements):
         assert all(element.level is self for element in elements)
         stack.push(self.tr("Add elements to database"),
                    stack.Call(self._addToDb, elements),
                    stack.Call(self._removeFromDb, elements))
Example #4
0
def addSource(**data):
    from maestro.filesystem.sources import Source
    source = Source(**data)
    stack.push(translate('Filesystem', 'Add source'),
               stack.Call(_addSource, source),
               stack.Call(_deleteSource, source))
Example #5
0
def deleteSource(source):
    stack.push(translate('filesystem', 'Delete source'),
               stack.Call(_deleteSource, source),
               stack.Call(_addSource, source))