def _refresh(self, pillow, path): if self._path is None: return try: # selection changed! if path == self._path + ".*": try: idx = PathHelper.getValue(self._document.selection, path + '._selection') if self._delegate: self._ignoreSelect = True self._delegate.selectRow(idx) except: pass elif Viewer.matchPath(self._path, path, mode=Viewer.OUTER): value = None if self._document: if self._isList: value = self._document.get(self._path, asList=True, wrap=self._wrapInList) else: value = self._document.get(self._path, asDict=True) if value and self._credentials: credential = self._credentials.getFlat(self._path) if credential == None or 'view' in credential or self._path == '_id': if self._delegate: self._delegate.dataCB(value) if not self._resolved: if self._document.hasConflicts(): d = self._document.loadConflicts() d.addCallback(self._conflictsArrived) else: self._noConflict() if self._delegate and self._inserted != None: self._delegate.editRow(self._inserted) else: if self._delegate: self._delegate.dataCB(None) if self._document != None and self._document.selection != None: # FIXME: Should we clear the selection here # if "*" in self._path: # self._document.select(self._path, None) sel = PathHelper.getValue(self._document.selection, self._path + '.*._selection') if sel != None and self._delegate != None: self._delegate.selectRow(sel) elif Viewer.matchPath(self._path, path, mode=Viewer.INNER): if self._delegate: self._delegate.changedCB() except SelectionNotSpecified as e: self._delegate.dataCB(None) self._inserted = None
def _refresh(self, pillow, path): if self.destroyed: return if path == None or self._readonly: self._setReadOnly(True) self._noConflict() return if self._document: try: if Viewer.matchPath(self._path, path, mode=Viewer.OUTER): self._document.get(self._path) if self._credentials: credential = self._credentials.getFlat(self._path) if self._path == '_id' or credential == None or 'edit' in credential: #Hide whole widget self._setReadOnly(self._readonly) if not self._resolved: if self._document.hasConflicts(): d = self._document.loadConflicts() d.addCallback(self._conflictsArrived) else: self._noConflict() except SelectionNotSpecified as e: self._setReadOnly(True) else: self._setReadOnly(True)
def _refresh(self, pillow, path): from wallaby.common.pathHelper import SelectionNotSpecified from twisted.internet import defer if self._path and Viewer.matchPath(self._path, path, mode=Viewer.OUTER): d = None try: if self._document: name = self._document.get(self._path) if name == None: name = self._path if name != None: d = defer.maybeDeferred(self._document.deferredGetAttachment, name) if d and self._credentials: credential = self._credentials.getFlat(self._path) if credential == None or 'view' in credential: self._cb(d, name) else: d = defer.Deferred() d.callback(None) self._cb(d, None) except SelectionNotSpecified as e: d = defer.Deferred() d.callback(None) self._cb(d, None)
def _refresh(self, pillow, path): from wallaby.common.pathHelper import SelectionNotSpecified try: if Viewer.matchPath(self._path, path, mode=Viewer.OUTER): value = False if self._document: value = bool(self._document.get(self._path)) if value and self._credentials: credential = self._credentials.getFlat(self._path) if credential == None or 'view' in credential or self._path == '_id': self._cb(value) else: self._cb(False) except SelectionNotSpecified as e: self._cb(False)
def _refresh(self, pillow, path): from wallaby.common.pathHelper import SelectionNotSpecified if self._path == None: return try: if Viewer.matchPath(self._path, path, mode=Viewer.OUTER): value = 0 if self._document: value = self._document.get(self._path) if value and self._credentials: credential = self._credentials.getFlat(self._path) if credential == None or "view" in credential or self._path == "_id": self._cb(value) else: self._cb(None) except SelectionNotSpecified as e: self._cb(None)
if self._document: try: currentIdx = PathHelper.getValue(self._document.selection, self._path + '.*._selection') # already selected if currentIdx == idx: return except: pass from documentChanger import DocumentChanger self._throw(DocumentChanger.In.Select, (self._path, idx)) def _rowInserted(self, pillow, (path, key)): if self._path is None or self._delegate is None: return if Viewer.matchPath(self._path, path, mode=Viewer.OUTER): self._inserted = key def _refresh(self, pillow, path): if self._path is None: return try: # selection changed! if path == self._path + ".*": try: idx = PathHelper.getValue(self._document.selection, path + '._selection') if self._delegate: self._ignoreSelect = True self._delegate.selectRow(idx) except: pass