Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply configurable sort to next and previous images #288

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ commands:
steps:
- run:
name: Install Codecov client
command: pip install codecov==2.1.9
command: pip install codecov
- run:
name: Upload coverage
# Retry as codecov can be flaky
command: for i in $(seq 1 10); do [ $i -gt 1 ] && echo "retrying $i" && sleep 5; codecov --required --disable search pycov gcov --root project --file .tox/coverage/py_coverage.xml .tox/coverage/cobertura-coverage.xml && s=0 && break || s=$?; done; (exit $s)
command: for i in $(seq 1 10); do [ $i -gt 1 ] && echo "retrying $i" && sleep 5; codecov --disable search pycov gcov --file .tox/coverage/py_coverage.xml .tox/coverage/cobertura-coverage.xml && s=0 && break || s=$?; done; (exit $s)

jobs:
py36:
Expand Down
17 changes: 15 additions & 2 deletions histomicsui/rest/image_browse_resource.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import girder_large_image
from girder.api import access
from girder.api.describe import Description, autoDescribeRoute
from girder.api.v1.item import Item as ItemResource
Expand Down Expand Up @@ -31,10 +32,22 @@ def getAdjacentImages(self, currentImage, currentFolder=None):
folder = folderModel.load(
currentImage['folderId'], user=self.getCurrentUser(), level=AccessType.READ)

sort = [('name', 1)]
try:
conf = girder_large_image.YAMLConfigFile(
folder, '.large_image_config.yaml', self.getCurrentUser())
if conf['itemList']['defaultSort']:
sort = [(
('meta.' if entry['type'] == 'metadata' else '') + entry['value'],
1 if entry['dir'] == 'down' else -1)
for entry in conf['itemList']['defaultSort']]
except Exception:
pass

if folder.get('isVirtual'):
children = folderModel.childItems(folder, sort=[('name', 1)], includeVirtual=True)
children = folderModel.childItems(folder, sort=sort, includeVirtual=True)
else:
children = folderModel.childItems(folder, sort=[('name', 1)])
children = folderModel.childItems(folder, sort=sort)

allImages = [item for item in children if _isLargeImageItem(item)]
try:
Expand Down