Skip to content

Commit

Permalink
Reset rendering settings.
Browse files Browse the repository at this point in the history
Do not delete the owner settings but reset the
default for the currently used settings.
  • Loading branch information
jburel committed May 17, 2014
1 parent 7676229 commit 174eb3a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions components/tools/OmeroPy/src/omero/gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7559,6 +7559,23 @@ def saveDefaults (self):
self._re.saveCurrentSettings(ctx)
return True

@assert_re()
def resetDefaults(self):
if not self.canAnnotate():
return False
ns = self._conn.CONFIG.IMG_ROPTSNS
if ns:
opts = self._collectRenderOptions()
self.removeAnnotations(ns)
ann = omero.gateway.CommentAnnotationWrapper()
ann.setNs(ns)
ann.setValue('&'.join(['='.join(map(str, x)) for x in opts.items()]))
self.linkAnnotation(ann)
ctx = self._conn.SERVICE_OPTS.copy()
ctx.setOmeroGroup(self.details.group.id.val)
self._re.resetDefaults(ctx)
return True

def countArchivedFiles (self):
"""
Returns the number of Original 'archived' Files linked to primary pixels.
Expand Down
6 changes: 3 additions & 3 deletions components/tools/OmeroWeb/omeroweb/webgateway/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,8 +1639,8 @@ def applyRenderingSettings(image, rdef):
@jsonp
def reset_image_rdef_json (request, iid, conn=None, **kwargs):
"""
Try to remove all rendering defs the logged in user has for this image.
Reset rendering defs default for this image. Do not delete other related settings.
@param request: http request
@param iid: Image ID
@param conn: L{omero.gateway.BlitzGateway}
Expand All @@ -1649,7 +1649,7 @@ def reset_image_rdef_json (request, iid, conn=None, **kwargs):

img = conn.getObject("Image", iid)

if img is not None and img.resetRDefs():
if img is not None and img.resetDefaults():
user_id = conn.getEventContext().userId
server_id = request.session['connector'].server_id
webgateway_cache.invalidateObject(server_id, user_id, img)
Expand Down

0 comments on commit 174eb3a

Please sign in to comment.