histomicsui 1.8.1.dev222__tar.gz → 1.8.1.dev253__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. {histomicsui-1.8.1.dev222/histomicsui.egg-info → histomicsui-1.8.1.dev253}/PKG-INFO +1 -1
  2. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/config_options.rst +26 -2
  3. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/controls.rst +2 -0
  4. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253/histomicsui.egg-info}/PKG-INFO +1 -1
  5. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui.egg-info/SOURCES.txt +1 -0
  6. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui.egg-info/scm_file_list.json +11 -0
  7. histomicsui-1.8.1.dev253/histomicsui.egg-info/scm_version.json +8 -0
  8. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_files/.histomicsui_config.yaml +1 -0
  9. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/allowedGroupsSpec.js +14 -14
  10. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/analysisSpec.js +53 -8
  11. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/annotationSpec.js +342 -0
  12. histomicsui-1.8.1.dev253/tests/web_client_specs/hotkeysSpec.js +155 -0
  13. histomicsui-1.8.1.dev222/histomicsui.egg-info/scm_version.json +0 -8
  14. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/.circleci/config.yml +0 -0
  15. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/.circleci/get_version.py +0 -0
  16. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/.circleci/publish_pypi.sh +0 -0
  17. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/.editorconfig +0 -0
  18. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/.git-blame-ignore-revs +0 -0
  19. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/.gitignore +0 -0
  20. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/.pre-commit-config.yaml +0 -0
  21. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/LICENSE +0 -0
  22. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/MANIFEST.in +0 -0
  23. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/NOTICE +0 -0
  24. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/README.rst +0 -0
  25. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/codecov.yml +0 -0
  26. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/annotation_group_restrictions.rst +0 -0
  27. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/images/cut.gif +0 -0
  28. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/images/difference.gif +0 -0
  29. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/images/intersect.gif +0 -0
  30. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/images/union.gif +0 -0
  31. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/images/xor.gif +0 -0
  32. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/docs/slicer_cli_plugins.rst +0 -0
  33. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/__init__.py +0 -0
  34. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/constants.py +0 -0
  35. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/girder_worker_plugin.py +0 -0
  36. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/handlers.py +0 -0
  37. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/models/__init__.py +0 -0
  38. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/models/aperio.py +0 -0
  39. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/models/case.py +0 -0
  40. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/models/cohort.py +0 -0
  41. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/models/image.py +0 -0
  42. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/models/meta.py +0 -0
  43. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/models/pathology.py +0 -0
  44. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/models/slide.py +0 -0
  45. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/rest/__init__.py +0 -0
  46. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/rest/aperio.py +0 -0
  47. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/rest/hui_resource.py +0 -0
  48. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/rest/image_browse_resource.py +0 -0
  49. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/rest/system.py +0 -0
  50. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui/rest/tcga.py +0 -0
  51. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui.egg-info/dependency_links.txt +0 -0
  52. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui.egg-info/entry_points.txt +0 -0
  53. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui.egg-info/not-zip-safe +0 -0
  54. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui.egg-info/requires.txt +0 -0
  55. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/histomicsui.egg-info/top_level.txt +0 -0
  56. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/pyproject.toml +0 -0
  57. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/requirements-dev.txt +0 -0
  58. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/ruff.toml +0 -0
  59. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/sample_data/Easy1.png +0 -0
  60. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/sample_data/sample_svs_image.TCGA-DU-6399-01A-01-TS1.e8eb65de-d63e-42db-af6f-14fefbbdf7bd.svs +0 -0
  61. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/setup.cfg +0 -0
  62. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/setup.py +0 -0
  63. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/__init__.py +0 -0
  64. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/conftest.py +0 -0
  65. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/datastore.py +0 -0
  66. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/girder_utilities.py +0 -0
  67. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_files/sample.anot +0 -0
  68. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_files/sample.meta +0 -0
  69. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_files/sample_girder_id.anot +0 -0
  70. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_files/test_analysis_detection.xml +0 -0
  71. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_files/test_analysis_features.xml +0 -0
  72. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_handlers.py +0 -0
  73. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_hui_rest.py +0 -0
  74. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_image_browse_endpoints.py +0 -0
  75. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_load.py +0 -0
  76. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/test_tcga.py +0 -0
  77. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/.eslintrc +0 -0
  78. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/girderUISpec.js +0 -0
  79. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/huiSpec.js +0 -0
  80. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/huiTest.js +0 -0
  81. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/itemSpec.js +0 -0
  82. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/metadataPanelSpec.js +0 -0
  83. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/metadataPlotSpec.js +0 -0
  84. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/overviewPanelSpec.js +0 -0
  85. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/panelLayoutSpec.js +0 -0
  86. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tests/web_client_specs/pixelmapCategorySpec.js +0 -0
  87. {histomicsui-1.8.1.dev222 → histomicsui-1.8.1.dev253}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: histomicsui
3
- Version: 1.8.1.dev222
3
+ Version: 1.8.1.dev253
4
4
  Summary: Organize, visualize, and analyze histology images.
5
5
  Home-page: https://github.com/DigitalSlideArchive/histomicsui
6
6
  Author: Kitware, Inc.
@@ -66,7 +66,14 @@ _________________
66
66
  lineColor: rgb(0, 0, 255)
67
67
  lineWidth: 2
68
68
 
69
- If a hotkey is specified for a group, it will only be active if the group was loaded from the config file. That is, moving to another folder where the config file does not apply will disable the hotkey. If you want hotkeys to have modifiers (e.g., require that alt, ctrl, or meta be pressed or explicitly NOT pressed), you can add a hotkey section:
69
+ If a hotkey is specified for a group, it will only be active if the group was loaded from the config file. That is, moving to another folder where the config file does not apply will disable the hotkey.
70
+
71
+ Hotkeys
72
+ _______
73
+
74
+ Most keyboard shortcuts can be changed with a ``hotkeys`` section. Each entry names an ``action`` and a ``key``. A key is a single key name, optionally preceded by modifiers joined with ``+`` or ``-``, such as ``r``, ``shift+s``, ``ctrl+alt+x``, ``left``, ``space``, ``esc``, or ``plus``. Modifiers can also be given as ``ctrl``, ``alt``, ``meta``, or ``shift`` values of ``true``. Modifiers that are not listed must not be pressed, except that ``shift`` is ignored for punctuation that needs it to be typed.
75
+
76
+ If any entry mentions an action, the listed keys replace that action's default keys, and any other action that had one of those keys by default loses it. An action can have more than one key by listing it more than once, and ``key: null`` removes all of its keys.
70
77
 
71
78
  ::
72
79
 
@@ -75,9 +82,26 @@ If a hotkey is specified for a group, it will only be active if the group was lo
75
82
  -
76
83
  key: r
77
84
  ctrl: true
78
- alt: false
79
85
  action: group
80
86
  param: Red
87
+ -
88
+ key: h
89
+ action: pan.left
90
+ -
91
+ key: x
92
+ action: draw.rectangle
93
+
94
+ The ``group`` action selects the style group named by ``param``. The other actions are:
95
+
96
+ - Navigation: ``pan.left ``, ``pan.right ``, ``pan.up ``, ``pan.down ``, ``zoom.in ``, ``zoom.out ``, ``rotate.ccw ``, ``rotate.cw ``, ``rotate.0 `` (reset rotation), and ``zoom.0 ``, ``zoom.3 ``, ... ``zoom.18 `` (jump to a zoom level). For the panning, zooming, and rotating actions, only the base key is set; holding shift or ctrl+shift with it still makes a larger step.
97
+ - Annotations: ``annotations.toggle ``, ``annotation.create ``, ``element.edit ``, ``element.menu ``, ``select.rectangle ``, ``select.polygon ``, ``select.clear ``.
98
+ - Drawing: ``draw.point ``, ``draw.rectangle ``, ``draw.ellipse ``, ``draw.circle ``, ``draw.polygon ``, ``draw.line ``, ``draw.brush ``, ``draw.finish ``, ``draw.cancel ``, ``brush.shape ``, ``brush.smaller ``, ``brush.larger ``, ``group.previous ``, ``group.next ``.
99
+ - Channels and bands: ``layer.1 `` through ``layer.20 `` toggle the visibility of that channel or band when compositing in the frame selector. By default these are ctrl+1 through ctrl+0 and ctrl+alt+1 through ctrl+alt+0.
100
+
101
+ User Hotkeys
102
+ ~~~~~~~~~~~~
103
+
104
+ Logged-in users can choose their own keys from **Keyboard shortcuts** in the user menu. These are saved as a ``hotkeys `` section, in the same format as above, in a ``.histomicsui_user_config.yaml `` file in the user's private folder (normally ``Private ``; see large_image's per-user configuration files), which can also be edited directly. If the user makes that folder public, their hotkeys no longer apply. User hotkeys apply in every folder and take precedence over the folder's config file. **Reset all** in the dialog removes them.
81
105
 
82
106
  Unselected Annotation Capacity
83
107
  ______________________________
@@ -1,6 +1,8 @@
1
1
  Mouse and Keyboard Controls
2
2
  ===========================
3
3
 
4
+ The keys listed here are the defaults. Most of them can be changed by an administrator in a folder's config file (see :doc:`config_options`) or by each user from **Keyboard shortcuts** in the user menu.
5
+
4
6
  Basic Image Controls
5
7
  --------------------
6
8
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: histomicsui
3
- Version: 1.8.1.dev222
3
+ Version: 1.8.1.dev253
4
4
  Summary: Organize, visualize, and analyze histology images.
5
5
  Home-page: https://github.com/DigitalSlideArchive/histomicsui
6
6
  Author: Kitware, Inc.
@@ -74,6 +74,7 @@ tests/web_client_specs/allowedGroupsSpec.js
74
74
  tests/web_client_specs/analysisSpec.js
75
75
  tests/web_client_specs/annotationSpec.js
76
76
  tests/web_client_specs/girderUISpec.js
77
+ tests/web_client_specs/hotkeysSpec.js
77
78
  tests/web_client_specs/huiSpec.js
78
79
  tests/web_client_specs/huiTest.js
79
80
  tests/web_client_specs/itemSpec.js
@@ -46,6 +46,7 @@
46
46
  "histomicsui/web_client/collections/index.js",
47
47
  "histomicsui/web_client/dialogs/confirmDialog.js",
48
48
  "histomicsui/web_client/dialogs/editElement.js",
49
+ "histomicsui/web_client/dialogs/editHotkeys.js",
49
50
  "histomicsui/web_client/dialogs/editRegionOfInterest.js",
50
51
  "histomicsui/web_client/dialogs/editStyleGroups.js",
51
52
  "histomicsui/web_client/dialogs/index.js",
@@ -55,6 +56,7 @@
55
56
  "histomicsui/web_client/dialogs/saveAnnotation.js",
56
57
  "histomicsui/web_client/events.js",
57
58
  "histomicsui/web_client/histomicsui.ts",
59
+ "histomicsui/web_client/hotkeys.js",
58
60
  "histomicsui/web_client/index.html",
59
61
  "histomicsui/web_client/index.js",
60
62
  "histomicsui/web_client/main.js",
@@ -77,6 +79,7 @@
77
79
  "histomicsui/web_client/static/favicon.png",
78
80
  "histomicsui/web_client/stylesheets/body/configView.styl",
79
81
  "histomicsui/web_client/stylesheets/body/image.styl",
82
+ "histomicsui/web_client/stylesheets/dialogs/editHotkeys.styl",
80
83
  "histomicsui/web_client/stylesheets/dialogs/editStyleGroups.styl",
81
84
  "histomicsui/web_client/stylesheets/dialogs/metadataPlot.styl",
82
85
  "histomicsui/web_client/stylesheets/dialogs/openAnnotatedImage.styl",
@@ -94,6 +97,7 @@
94
97
  "histomicsui/web_client/stylesheets/panels/regionSelector.styl",
95
98
  "histomicsui/web_client/stylesheets/panels/zoomWidget.styl",
96
99
  "histomicsui/web_client/stylesheets/popover/annotationContextMenu.styl",
100
+ "histomicsui/web_client/stylesheets/popover/annotationLegend.styl",
97
101
  "histomicsui/web_client/stylesheets/popover/annotationPopover.styl",
98
102
  "histomicsui/web_client/stylesheets/views/itemList.styl",
99
103
  "histomicsui/web_client/stylesheets/views/searchResultsView.styl",
@@ -102,12 +106,16 @@
102
106
  "histomicsui/web_client/templates/dialogs/annotatedImageList.pug",
103
107
  "histomicsui/web_client/templates/dialogs/confirmDialog.pug",
104
108
  "histomicsui/web_client/templates/dialogs/editElement.pug",
109
+ "histomicsui/web_client/templates/dialogs/editHotkeys.pug",
105
110
  "histomicsui/web_client/templates/dialogs/editRegionOfInterest.pug",
106
111
  "histomicsui/web_client/templates/dialogs/editStyleGroups.pug",
107
112
  "histomicsui/web_client/templates/dialogs/metadataPlot.pug",
108
113
  "histomicsui/web_client/templates/dialogs/openAnnotatedImage.pug",
109
114
  "histomicsui/web_client/templates/dialogs/openImage.pug",
110
115
  "histomicsui/web_client/templates/dialogs/saveAnnotation.pug",
116
+ "histomicsui/web_client/templates/dialogs/saveAnnotationLegendEntry.pug",
117
+ "histomicsui/web_client/templates/dialogs/saveAnnotationLegendEntryRow.pug",
118
+ "histomicsui/web_client/templates/dialogs/saveAnnotationLegendStopRow.pug",
111
119
  "histomicsui/web_client/templates/elementProps.pug",
112
120
  "histomicsui/web_client/templates/layout/header.pug",
113
121
  "histomicsui/web_client/templates/layout/headerAnalyses.pug",
@@ -125,6 +133,7 @@
125
133
  "histomicsui/web_client/templates/panels/regionSelector.pug",
126
134
  "histomicsui/web_client/templates/panels/zoomWidget.pug",
127
135
  "histomicsui/web_client/templates/popover/annotationContextMenu.pug",
136
+ "histomicsui/web_client/templates/popover/annotationLegend.pug",
128
137
  "histomicsui/web_client/templates/popover/annotationPopover.pug",
129
138
  "histomicsui/web_client/templates/popover/annotationPopoverMetadata.pug",
130
139
  "histomicsui/web_client/templates/popover/pixelmapContextMenu.pug",
@@ -154,6 +163,7 @@
154
163
  "histomicsui/web_client/views/layout/LoginView.js",
155
164
  "histomicsui/web_client/views/layout/index.js",
156
165
  "histomicsui/web_client/views/popover/AnnotationContextMenu.js",
166
+ "histomicsui/web_client/views/popover/AnnotationLegend.js",
157
167
  "histomicsui/web_client/views/popover/AnnotationPopover.js",
158
168
  "histomicsui/web_client/views/popover/PixelmapContextMenu.js",
159
169
  "histomicsui/web_client/views/popover/index.js",
@@ -195,6 +205,7 @@
195
205
  "tests/web_client_specs/analysisSpec.js",
196
206
  "tests/web_client_specs/annotationSpec.js",
197
207
  "tests/web_client_specs/girderUISpec.js",
208
+ "tests/web_client_specs/hotkeysSpec.js",
198
209
  "tests/web_client_specs/huiSpec.js",
199
210
  "tests/web_client_specs/huiTest.js",
200
211
  "tests/web_client_specs/itemSpec.js",
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.8.0",
3
+ "distance": 253,
4
+ "node": "ge9281c89e9a89f93ef8dd4f325d52a4ed4a32a9e",
5
+ "dirty": false,
6
+ "branch": "girder-5",
7
+ "node_date": "2026-11-16"
8
+ }
@@ -30,6 +30,7 @@ annotationGroups:
30
30
  lineWidth: 4
31
31
  -
32
32
  id: Red
33
+ hotkey: shift+r
33
34
  fillColor: rgba(255, 0, 0, 0.25)
34
35
  lineColor: rgb(255, 0, 0)
35
36
  lineWidth: 2
@@ -206,7 +206,7 @@ girderTest.promise.done(function () {
206
206
 
207
207
  it('creates a restricted and an unrestricted annotation', function () {
208
208
  createAnnotation('restricted annotation for #5', {
209
- allowed_groups: ['groupE', 'groupF']
209
+ allowed_groups: ['groupF', 'groupG']
210
210
  }, [rectangleElement(30, 30)], restricted);
211
211
  });
212
212
 
@@ -214,16 +214,16 @@ girderTest.promise.done(function () {
214
214
  createAnnotation('unrestricted annotation for #5', {}, [rectangleElement(40, 40)], unrestricted);
215
215
  });
216
216
 
217
- it('auto-creates the restricted annotation\'s allowed groups (groupE/groupF) as styles', function () {
218
- // briefly edit the restricted annotation in the Draw panel to create groupE and
219
- // groupF before switching the active annotation below.
217
+ it('auto-creates the restricted annotation\'s allowed groups (groupF/groupG) as styles', function () {
218
+ // briefly edit the restricted annotation in the Draw panel to create groupF and
219
+ // groupG before switching the active annotation below.
220
220
  var bodyView = huiTest.app.bodyView;
221
221
  bodyView.annotations.add(restricted.annotation);
222
222
  bodyView._editAnnotation(restricted.annotation);
223
223
  waitsFor(function () {
224
224
  return !!bodyView.drawWidget &&
225
- bodyView.drawWidget._groups.has('groupE') &&
226
- bodyView.drawWidget._groups.has('groupF');
225
+ bodyView.drawWidget._groups.has('groupF') &&
226
+ bodyView.drawWidget._groups.has('groupG');
227
227
  });
228
228
  });
229
229
 
@@ -247,7 +247,7 @@ girderTest.promise.done(function () {
247
247
  bodyView._selectElement(element);
248
248
 
249
249
  var groups = bodyView.contextMenu._getAnnotationGroups();
250
- expect(groups.sort()).toEqual(['groupE', 'groupF']);
250
+ expect(groups.sort()).toEqual(['groupF', 'groupG']);
251
251
  });
252
252
  });
253
253
 
@@ -274,7 +274,7 @@ girderTest.promise.done(function () {
274
274
  var renderedGroups = bodyView.contextMenu.$('.h-set-group').map(function () {
275
275
  return window.$(this).data('group');
276
276
  }).get();
277
- expect(renderedGroups.sort()).toEqual(['groupE', 'groupF']);
277
+ expect(renderedGroups.sort()).toEqual(['groupF', 'groupG']);
278
278
  });
279
279
  });
280
280
  });
@@ -352,32 +352,32 @@ girderTest.promise.done(function () {
352
352
  // simulate editing the annotation's metadata via the "Edit annotation" dialog,
353
353
  // which mutates attributes directly and triggers 'change:annotation' rather than
354
354
  // calling .set()
355
- result.annotation.get('annotation').attributes = {allowed_groups: ['groupG', 'groupH']};
355
+ result.annotation.get('annotation').attributes = {allowed_groups: ['groupF', 'groupG']};
356
356
  result.annotation.trigger('change:annotation', result.annotation, {});
357
357
 
358
358
  waitsFor(function () {
359
359
  // the Draw panel's `_groups` collection updates synchronously, but its dropdown
360
360
  // DOM is refreshed via a debounced render, so also wait for the DOM to catch up
361
361
  // before asserting on it
362
- return drawWidget._groups.has('groupG') && drawWidget._groups.has('groupH') &&
362
+ return drawWidget._groups.has('groupF') && drawWidget._groups.has('groupG') &&
363
363
  drawWidget.$('.h-style-group option').length === 2;
364
364
  });
365
365
  runs(function () {
366
- expect(drawWidget._style.id).toBe('groupG');
366
+ expect(drawWidget._style.id).toBe('groupF');
367
367
  var drawValues = drawWidget.$('.h-style-group option').map(function () {
368
368
  return this.value;
369
369
  }).get();
370
- expect(drawValues).toEqual(['groupG', 'groupH']);
370
+ expect(drawValues).toEqual(['groupF', 'groupG']);
371
371
  });
372
372
  // the context menu keeps its own StyleCollection, refetched asynchronously via the
373
373
  // 'h:styleGroupsEdited' event once the Draw panel auto-creates the newly allowed
374
374
  // groups; wait for that refetch to complete before checking it
375
375
  waitsFor(function () {
376
- return bodyView.contextMenu.styles.get('groupG') && bodyView.contextMenu.styles.get('groupH');
376
+ return bodyView.contextMenu.styles.get('groupF') && bodyView.contextMenu.styles.get('groupG');
377
377
  });
378
378
  runs(function () {
379
379
  var contextGroups = bodyView.contextMenu._getAnnotationGroups();
380
- expect(contextGroups.sort()).toEqual(['groupG', 'groupH']);
380
+ expect(contextGroups.sort()).toEqual(['groupF', 'groupG']);
381
381
  });
382
382
  });
383
383
  });
@@ -39,12 +39,14 @@ girderTest.promise.done(function () {
39
39
 
40
40
  it('get dropdown values', function () {
41
41
  var $el = $('.h-analyses-dropdown');
42
- expect($el.find('a:contains("huirchive/histomicstk")').length).toBe(1);
42
+ var image = $el.find('.h-analyses-image a:contains("huirchive/histomicstk")');
43
+ expect(image.length).toBe(1);
44
+ expect($el.find('.h-analyses-recent').length).toBe(0);
45
+ image.click();
43
46
 
44
- $el = $el.find('.dropdown-submenu:first');
45
- expect($el.find('a:contains("latest")').length).toBe(1);
47
+ $el = $el.find('.h-analyses-task-group.h-active');
48
+ expect($el.find('.h-analyses-version-name:contains("latest")').length).toBe(1);
46
49
 
47
- $el = $el.find('.dropdown-menu:first');
48
50
  var link = $el.find('a:contains("NucleiDetection")');
49
51
  expect(link.length).toBe(1);
50
52
 
@@ -124,10 +126,12 @@ girderTest.promise.done(function () {
124
126
  });
125
127
  it('open a new analysis', function () {
126
128
  var $el = $('.h-analyses-dropdown');
127
- expect($el.find('a:contains("huirchive/histomicstk")').length).toBe(1);
129
+ var image = $el.find('.h-analyses-image a:contains("huirchive/histomicstk")');
130
+ expect(image.length).toBe(1);
131
+ image.click();
128
132
 
129
- $el = $el.find('.dropdown-submenu:first');
130
- expect($el.find('a:contains("latest")').length).toBe(1);
133
+ $el = $el.find('.h-analyses-task-group.h-active');
134
+ expect($el.find('.h-analyses-version-name:contains("latest")').length).toBe(1);
131
135
 
132
136
  var link = $el.find('a:contains("ComputeNucleiFeatures")');
133
137
  expect(link.length).toBe(1);
@@ -157,9 +161,50 @@ girderTest.promise.done(function () {
157
161
  }, 'region annotation to be removed');
158
162
  });
159
163
  });
164
+ describe('analyses menu', function () {
165
+ it('recently used', function () {
166
+ var $el = $('.h-analyses-dropdown');
167
+ expect($el.find('.h-analyses-recent').length).toBe(1);
168
+ $el.find('.h-analyses-recent a').click();
169
+ var links = $el.find('.h-analyses-task-group.h-active .h-analysis-item');
170
+ expect(links.length).toBe(2);
171
+ expect(links.eq(0).attr('data-cli')).toBe('ComputeNucleiFeatures');
172
+ expect(links.eq(0).find('.h-analyses-item-source').text()).toBe('huirchive/histomicstk:latest');
173
+ expect(links.eq(1).attr('data-cli')).toBe('NucleiDetection');
174
+ });
175
+ it('filter', function () {
176
+ var $el = $('.h-analyses-dropdown');
177
+ $el.find('.h-analyses-filter').val('histomicstk detect').trigger('input');
178
+ var links = $el.find('li:not(.hidden) > .h-analysis-item');
179
+ // one in the recently used list and one in the image
180
+ expect(links.length).toBe(2);
181
+ expect(links.filter('[data-cli="NucleiDetection"]').length).toBe(2);
182
+ expect($el.find('.h-analyses-empty').hasClass('hidden')).toBe(true);
183
+
184
+ $el.find('.h-analyses-filter').val('nosuchanalysis').trigger('input');
185
+ expect($el.find('li:not(.hidden) > .h-analysis-item').length).toBe(0);
186
+ expect($el.find('.h-analyses-image:not(.hidden)').length).toBe(0);
187
+ expect($el.find('.h-analyses-empty').hasClass('hidden')).toBe(false);
188
+
189
+ $el.find('.h-analyses-filter').val('').trigger('input');
190
+ expect($el.find('li:not(.hidden) > .h-analysis-item').length).toBe(4);
191
+ expect($el.find('.h-analyses-image:not(.hidden)').length).toBe(2);
192
+ expect($el.find('.h-analyses-task-group.h-active').length).toBe(1);
193
+ });
194
+ it('keyboard', function () {
195
+ var $el = $('.h-analyses-dropdown');
196
+ $el.find('.h-analyses-recent a').click();
197
+ expect($el.find('.h-analyses-task-group.h-active').attr('data-key')).toBe(':recent');
198
+ // moving focus to an image shows its tasks
199
+ $el.find('.h-analyses-image a:contains("huirchive/histomicstk")').trigger('focusin');
200
+ var $group = $el.find('.h-analyses-task-group.h-active');
201
+ expect($group.attr('data-key')).toBe('huirchive/histomicstk');
202
+ expect($group.find('.h-analysis-item').length).toBe(2);
203
+ });
204
+ });
160
205
  describe('close analysis', function () {
161
206
  it('open analysis', function () {
162
- var $el = $('.h-analyses-dropdown');
207
+ var $el = $('.h-analyses-dropdown .h-analyses-task-group[data-key="huirchive/histomicstk"]');
163
208
  var link = $el.find('a:contains("NucleiDetection")');
164
209
  link.click();
165
210
  girderTest.waitForLoad();
@@ -643,6 +643,94 @@ girderTest.promise.done(function () {
643
643
  expect($('.h-draw.active').length).toBe(0);
644
644
  });
645
645
  });
646
+ describe('customize keyboard shortcuts', function () {
647
+ function openHotkeysDialog() {
648
+ runs(function () {
649
+ $('.h-user-dropdown-link').click();
650
+ $('a.h-edit-hotkeys').click();
651
+ });
652
+ girderTest.waitForDialog();
653
+ waitsFor(function () {
654
+ return $('.h-hotkey-row[data-action="draw.rectangle"]').length > 0;
655
+ }, 'hotkey dialog to render');
656
+ }
657
+ function pressKey(key) {
658
+ // the dialog listens with a native capture listener
659
+ var evt;
660
+ try {
661
+ evt = new KeyboardEvent('keydown', {key: key, bubbles: true, cancelable: true});
662
+ } catch (err) {
663
+ evt = document.createEvent('Event');
664
+ evt.initEvent('keydown', true, true);
665
+ Object.defineProperty(evt, 'key', {value: key});
666
+ }
667
+ document.dispatchEvent(evt);
668
+ }
669
+
670
+ openHotkeysDialog();
671
+ it('rebind draw rectangle to x', function () {
672
+ runs(function () {
673
+ expect($('.h-hotkey-row[data-action="draw.rectangle"] kbd').text()).toBe('R');
674
+ var enter = $.Event('keydown', {key: 'Enter'});
675
+ $('.h-hotkeys-filter').trigger(enter);
676
+ expect(enter.isDefaultPrevented()).toBe(true);
677
+ $('.h-hotkey-row[data-action="draw.rectangle"] .h-hotkey-change').click();
678
+ expect($('.h-hotkey-capturing').length).toBe(1);
679
+ pressKey('x');
680
+ expect($('.h-hotkey-row[data-action="draw.rectangle"] kbd').text()).toBe('X');
681
+ expect($('.h-hotkey-row[data-action="draw.rectangle"] .h-hotkey-source').text()).toBe('custom');
682
+ $('.h-submit').click();
683
+ });
684
+ girderTest.waitForLoad();
685
+ runs(function () {
686
+ $('.h-image-body').trigger($.Event('keydown', {key: 'x'}));
687
+ expect($('.h-draw.active').attr('data-type')).toBe('rectangle');
688
+ $('.h-image-body').trigger($.Event('keydown', {key: 'x'}));
689
+ expect($('.h-draw.active').length).toBe(0);
690
+ $('.h-image-body').trigger($.Event('keydown', {key: 'r'}));
691
+ expect($('.h-draw.active').length).toBe(0);
692
+ expect($('button.h-draw[data-type="rectangle"]').attr('title')).toBe('Draw a new rectangle (keyboard shortcut: X)');
693
+ });
694
+ var userConfig;
695
+ runs(function () {
696
+ girder.rest.restRequest({
697
+ url: 'user/' + girder.auth.getCurrentUser().id + '/yaml_config/.histomicsui_user_config.yaml'
698
+ }).done(function (result) {
699
+ userConfig = result;
700
+ });
701
+ });
702
+ waitsFor(function () {
703
+ return userConfig !== undefined;
704
+ }, 'user config to load');
705
+ runs(function () {
706
+ expect(userConfig.hotkeys).toEqual([{action: 'draw.rectangle', key: 'x'}]);
707
+ });
708
+ });
709
+ openHotkeysDialog();
710
+ it('reset all keyboard shortcuts', function () {
711
+ runs(function () {
712
+ var list = $('.h-hotkeys-list');
713
+ expect(list[0].scrollHeight).toBeGreaterThan(list.innerHeight());
714
+ list.scrollTop(200);
715
+ $('.h-hotkey-row[data-action="layer.20"] .h-hotkey-clear').click();
716
+ expect($('.h-hotkeys-list').scrollTop()).toBe(200);
717
+ $('.h-hotkey-row[data-action="layer.20"] .h-hotkey-change').click();
718
+ pressKey('x');
719
+ expect($('.h-hotkeys-message').text()).toBe('X was removed from "Draw a rectangle".');
720
+ expect($('.modal-footer')[0].getBoundingClientRect().bottom).not.toBeGreaterThan(window.innerHeight);
721
+ $('.h-hotkeys-reset-all').click();
722
+ expect($('.h-hotkey-row[data-action="draw.rectangle"] kbd').text()).toBe('R');
723
+ $('.h-submit').click();
724
+ });
725
+ girderTest.waitForLoad();
726
+ runs(function () {
727
+ $('.h-image-body').trigger($.Event('keydown', {key: 'r'}));
728
+ expect($('.h-draw.active').attr('data-type')).toBe('rectangle');
729
+ $('.h-image-body').trigger($.Event('keydown', {key: 'r'}));
730
+ expect($('.h-draw.active').length).toBe(0);
731
+ });
732
+ });
733
+ });
646
734
  });
647
735
 
648
736
  describe('Sort By', function () {
@@ -1151,6 +1239,207 @@ girderTest.promise.done(function () {
1151
1239
  });
1152
1240
  });
1153
1241
 
1242
+ it('edit annotation legend', function () {
1243
+ runs(function () {
1244
+ expect($('.h-annotation-legend-container').hasClass('hidden')).toBe(true);
1245
+ $('.h-annotation-selector .h-annotation:contains("drawn 2") .h-edit-annotation-metadata').click();
1246
+ });
1247
+
1248
+ girderTest.waitForDialog();
1249
+ runs(function () {
1250
+ expect($('#h-annotation-name').val()).toBe('drawn 2');
1251
+ expect($('.h-legend-entry').length).toBe(0);
1252
+ $('.h-add-legend-entry').click();
1253
+ $('.h-add-legend-entry').click();
1254
+ expect($('.h-legend-entry').length).toBe(2);
1255
+ $('.h-legend-entry:first .h-legend-label').val('High');
1256
+ $('.h-legend-entry:first .h-legend-fill-color').val('red');
1257
+ $('.h-legend-entry:last .h-legend-label').val('Low');
1258
+ $('.h-legend-entry:last .h-legend-fill-color').val('blue');
1259
+ $('.h-legend-entry:last .h-legend-line-color').val('black');
1260
+ $('.h-legend-entry:last .h-legend-line-width').val(2);
1261
+ // reorder the entries
1262
+ $('.h-legend-entry:last .h-legend-move-up').click();
1263
+ expect($('.h-legend-entry:first .h-legend-label').val()).toBe('Low');
1264
+ $('.h-legend-entry:first .h-legend-move-up').click();
1265
+ expect($('.h-legend-entry:first .h-legend-label').val()).toBe('Low');
1266
+ $('.h-legend-entry:first .h-legend-move-down').click();
1267
+ expect($('.h-legend-entry:first .h-legend-label').val()).toBe('High');
1268
+ $('.h-legend-entry:last .h-legend-move-up').click();
1269
+ expect($('.h-legend-entry:first .h-legend-label').val()).toBe('Low');
1270
+ // entries without a label or with invalid colors are rejected
1271
+ $('.h-add-legend-entry').click();
1272
+ $('.h-legend-entry:last .h-legend-fill-color').val('not a color');
1273
+ $('.h-submit').click();
1274
+
1275
+ var validationEl = $('.g-validation-failed-message');
1276
+ expect(validationEl.hasClass('hidden')).toBe(false);
1277
+ expect(validationEl.text()).toBe('Legend entries must have a label. Invalid legend color.');
1278
+ expect($('.h-legend-entry:last .has-error').length).toBe(2);
1279
+ expect($('.h-legend-entry:first .has-error').length).toBe(0);
1280
+ // entries without any color are rejected
1281
+ $('.h-legend-entry:last .h-legend-label').val('No color');
1282
+ $('.h-legend-entry:last .h-legend-fill-color').val('');
1283
+ $('.h-submit').click();
1284
+ expect(validationEl.text()).toBe('Legend entries must have a fill or line color.');
1285
+ expect($('.h-legend-entry:last .has-error').length).toBe(2);
1286
+
1287
+ $('.h-legend-entry:last .h-legend-remove').click();
1288
+ expect($('.h-legend-entry').length).toBe(2);
1289
+ $('.h-submit').click();
1290
+ });
1291
+
1292
+ girderTest.waitForLoad();
1293
+ runs(function () {
1294
+ var annotation = huiTest.app.bodyView.annotations.filter(function (annotation) {
1295
+ return annotation.get('annotation').name === 'drawn 2';
1296
+ })[0];
1297
+ expect(annotation.get('annotation').legend).toEqual([
1298
+ {label: 'Low', fillColor: 'rgb(0, 0, 255)', lineColor: 'rgb(0, 0, 0)', lineWidth: 2},
1299
+ {label: 'High', fillColor: 'rgb(255, 0, 0)'}
1300
+ ]);
1301
+ });
1302
+ waitsFor(function () {
1303
+ return $('.h-annotation-legend-container:not(.hidden) .h-annotation-legend-entry').length === 2;
1304
+ }, 'legend to be shown');
1305
+ runs(function () {
1306
+ var $legend = $('.h-annotation-legend-container');
1307
+ expect($legend.find('.h-annotation-legend-name').text()).toBe('drawn 2');
1308
+ expect($legend.find('.h-annotation-legend-label').first().text()).toBe('Low');
1309
+ expect($legend.find('.h-annotation-legend-label').last().text()).toBe('High');
1310
+ var swatch = $legend.find('.h-annotation-legend-swatch').first();
1311
+ expect(swatch.css('background-color')).toBe('rgb(0, 0, 255)');
1312
+ expect(swatch.css('border-top-color')).toBe('rgb(0, 0, 0)');
1313
+ expect(swatch.css('border-top-width')).toBe('2px');
1314
+ // collapse and expand the legend
1315
+ $legend.find('.h-annotation-legend-header').click();
1316
+ expect($legend.find('.h-annotation-legend-entry').length).toBe(0);
1317
+ expect($legend.find('.icon-up-open').length).toBe(1);
1318
+ $legend.find('.h-annotation-legend-header').click();
1319
+ expect($legend.find('.h-annotation-legend-entry').length).toBe(2);
1320
+ // hiding the annotation hides the legend
1321
+ $('.h-annotation-selector .h-annotation:contains("drawn 2") .h-toggle-annotation').click();
1322
+ });
1323
+ waitsFor(function () {
1324
+ return $('.h-annotation-legend-container').hasClass('hidden');
1325
+ }, 'legend to be hidden');
1326
+ runs(function () {
1327
+ $('.h-annotation-selector .h-annotation:contains("drawn 2") .h-toggle-annotation').click();
1328
+ });
1329
+ waitsFor(function () {
1330
+ return $('.h-annotation-legend-container:not(.hidden) .h-annotation-legend-entry').length === 2;
1331
+ }, 'legend to be shown again');
1332
+ runs(function () {
1333
+ // remove the legend
1334
+ $('.h-annotation-selector .h-annotation:contains("drawn 2") .h-edit-annotation-metadata').click();
1335
+ });
1336
+ girderTest.waitForDialog();
1337
+ runs(function () {
1338
+ expect($('.h-legend-entry').length).toBe(2);
1339
+ expect($('.h-legend-entry:first .h-legend-label').val()).toBe('Low');
1340
+ expect($('.h-legend-entry:first .h-legend-fill-color').val()).toMatch(/^rgb\(0, ?0, ?255\)$/);
1341
+ $('.h-legend-entry .h-legend-remove').click();
1342
+ expect($('.h-legend-entry').length).toBe(0);
1343
+ $('.h-submit').click();
1344
+ });
1345
+ girderTest.waitForLoad();
1346
+ runs(function () {
1347
+ var annotation = huiTest.app.bodyView.annotations.filter(function (annotation) {
1348
+ return annotation.get('annotation').name === 'drawn 2';
1349
+ })[0];
1350
+ expect(annotation.get('annotation').legend).toEqual([]);
1351
+ });
1352
+ waitsFor(function () {
1353
+ return $('.h-annotation-legend-container').hasClass('hidden');
1354
+ }, 'legend to be removed');
1355
+ });
1356
+
1357
+ it('edit annotation legend color range', function () {
1358
+ runs(function () {
1359
+ $('.h-annotation-selector .h-annotation:contains("drawn 2") .h-edit-annotation-metadata').click();
1360
+ });
1361
+
1362
+ girderTest.waitForDialog();
1363
+ runs(function () {
1364
+ expect($('.h-legend-entry').length).toBe(0);
1365
+ $('.h-add-legend-range').click();
1366
+ expect($('.h-legend-entry.h-legend-range-entry').length).toBe(1);
1367
+ expect($('.h-legend-stop').length).toBe(2);
1368
+ $('.h-legend-range-entry .h-legend-label').val('Patch IoU');
1369
+ $('.h-legend-stop:first .h-legend-stop-color').val('blue');
1370
+ // every color must be filled in
1371
+ $('.h-submit').click();
1372
+ var validationEl = $('.g-validation-failed-message');
1373
+ expect(validationEl.hasClass('hidden')).toBe(false);
1374
+ expect(validationEl.text()).toBe('Invalid legend color.');
1375
+ expect($('.h-legend-stop:last .has-error').length).toBe(1);
1376
+ // a range needs at least two colors
1377
+ $('.h-legend-stop:last .h-legend-remove-stop').click();
1378
+ expect($('.h-legend-stop').length).toBe(1);
1379
+ $('.h-submit').click();
1380
+ expect(validationEl.text()).toBe('Color ranges need at least two colors.');
1381
+ expect($('.h-legend-add-stop').hasClass('has-error')).toBe(true);
1382
+ $('.h-legend-add-stop').click();
1383
+ $('.h-legend-add-stop').click();
1384
+ expect($('.h-legend-stop').length).toBe(3);
1385
+ $('.h-legend-stop:eq(1) .h-legend-stop-color').val('white');
1386
+ $('.h-legend-stop:last .h-legend-stop-color').val('rgb(255, 0, 0)');
1387
+ $('.h-legend-stop:first .h-legend-stop-label').val('Low');
1388
+ $('.h-legend-stop:last .h-legend-stop-label').val('High');
1389
+ $('.h-legend-range-entry .h-legend-line-color').val('black');
1390
+ $('.h-submit').click();
1391
+ });
1392
+
1393
+ girderTest.waitForLoad();
1394
+ runs(function () {
1395
+ var annotation = huiTest.app.bodyView.annotations.filter(function (annotation) {
1396
+ return annotation.get('annotation').name === 'drawn 2';
1397
+ })[0];
1398
+ expect(annotation.get('annotation').legend).toEqual([{
1399
+ label: 'Patch IoU',
1400
+ fillColor: ['rgb(0, 0, 255)', 'rgb(255, 255, 255)', 'rgb(255, 0, 0)'],
1401
+ labels: ['Low', '', 'High'],
1402
+ lineColor: 'rgb(0, 0, 0)'
1403
+ }]);
1404
+ });
1405
+ waitsFor(function () {
1406
+ return $('.h-annotation-legend-container:not(.hidden) .h-annotation-legend-range').length === 1;
1407
+ }, 'legend range to be shown');
1408
+ runs(function () {
1409
+ var $range = $('.h-annotation-legend-container .h-annotation-legend-range');
1410
+ expect($range.find('.h-annotation-legend-label').text()).toBe('Patch IoU');
1411
+ expect($range.find('.h-annotation-legend-bar').attr('style')).toMatch(/linear-gradient\(to right, rgb\(0, 0, 255\), rgb\(255, 255, 255\), rgb\(255, 0, 0\)\)/);
1412
+ expect($range.find('.h-annotation-legend-bar').css('border-top-color')).toBe('rgb(0, 0, 0)');
1413
+ var $labels = $range.find('.h-annotation-legend-range-label');
1414
+ expect($labels.length).toBe(2);
1415
+ expect($labels.first().text()).toBe('Low');
1416
+ expect($labels.last().text()).toBe('High');
1417
+ // remove the legend
1418
+ $('.h-annotation-selector .h-annotation:contains("drawn 2") .h-edit-annotation-metadata').click();
1419
+ });
1420
+ girderTest.waitForDialog();
1421
+ runs(function () {
1422
+ expect($('.h-legend-range-entry').length).toBe(1);
1423
+ expect($('.h-legend-stop').length).toBe(3);
1424
+ expect($('.h-legend-stop:first .h-legend-stop-color').val()).toMatch(/^rgb\(0, ?0, ?255\)$/);
1425
+ expect($('.h-legend-stop:first .h-legend-stop-label').val()).toBe('Low');
1426
+ expect($('.h-legend-stop:eq(1) .h-legend-stop-label').val()).toBe('');
1427
+ $('.h-legend-entry .h-legend-remove').click();
1428
+ expect($('.h-legend-entry').length).toBe(0);
1429
+ $('.h-submit').click();
1430
+ });
1431
+ girderTest.waitForLoad();
1432
+ runs(function () {
1433
+ var annotation = huiTest.app.bodyView.annotations.filter(function (annotation) {
1434
+ return annotation.get('annotation').name === 'drawn 2';
1435
+ })[0];
1436
+ expect(annotation.get('annotation').legend).toEqual([]);
1437
+ });
1438
+ waitsFor(function () {
1439
+ return $('.h-annotation-legend-container').hasClass('hidden');
1440
+ }, 'legend to be removed');
1441
+ });
1442
+
1154
1443
  it('set annotation permissions to WRITE', function () {
1155
1444
  runs(function () {
1156
1445
  $('.h-annotation-selector .h-annotation:contains("edited 1") .h-edit-annotation-metadata').click();
@@ -1519,6 +1808,24 @@ girderTest.promise.done(function () {
1519
1808
  girderTest.waitForLoad();
1520
1809
  });
1521
1810
 
1811
+ it('edit the user hotkey file directly', function () {
1812
+ var done;
1813
+ runs(function () {
1814
+ girder.rest.restRequest({
1815
+ url: 'user/' + girder.auth.getCurrentUser().id + '/yaml_config/.histomicsui_user_config.yaml',
1816
+ method: 'PUT',
1817
+ contentType: 'application/x-yaml',
1818
+ processData: false,
1819
+ data: 'hotkeys:\n - action: draw.rectangle\n key: y\n'
1820
+ }).done(function () {
1821
+ done = true;
1822
+ });
1823
+ });
1824
+ waitsFor(function () {
1825
+ return done;
1826
+ }, 'user config to save');
1827
+ });
1828
+
1522
1829
  it('open a different image', function () {
1523
1830
  huiTest.waitsForPromise(
1524
1831
  huiTest.openImage('copy').done(function () {
@@ -1527,6 +1834,27 @@ girderTest.promise.done(function () {
1527
1834
  );
1528
1835
  });
1529
1836
 
1837
+ it('loads the user hotkey file with the image', function () {
1838
+ var done;
1839
+ waitsFor(function () {
1840
+ return girder.plugins.histomicsui.hotkeys.hotkeyText('draw.rectangle', huiTest.app.bodyView.hotkeys) === 'Y';
1841
+ }, 'user hotkeys to load');
1842
+ runs(function () {
1843
+ girder.rest.restRequest({
1844
+ url: 'user/' + girder.auth.getCurrentUser().id + '/yaml_config/.histomicsui_user_config.yaml',
1845
+ method: 'PUT',
1846
+ contentType: 'application/x-yaml',
1847
+ processData: false,
1848
+ data: '{}\n'
1849
+ }).done(function () {
1850
+ done = true;
1851
+ });
1852
+ });
1853
+ waitsFor(function () {
1854
+ return done;
1855
+ }, 'user config to reset');
1856
+ });
1857
+
1530
1858
  it('open the original image', function () {
1531
1859
  huiTest.waitsForPromise(
1532
1860
  huiTest.openImage('image').done(function () {
@@ -1986,8 +2314,22 @@ girderTest.promise.done(function () {
1986
2314
  return $('.h-annotation-selector .h-annotation:contains("drawn c1")').length === 0;
1987
2315
  }, '"drawn c1" to be deleted');
1988
2316
  });
2317
+ it('uses group hotkeys from the config', function () {
2318
+ waitsFor(function () {
2319
+ var bindings = huiTest.app.bodyView.hotkeys.bindings['group:Red'];
2320
+ return bindings && bindings.length === 1;
2321
+ }, 'config hotkeys to load');
2322
+ runs(function () {
2323
+ expect(girder.plugins.histomicsui.hotkeys.hotkeyText('group:Red', huiTest.app.bodyView.hotkeys)).toBe('Shift+R');
2324
+ });
2325
+ });
1989
2326
  it('open original image', function () {
1990
2327
  huiTest.openImage('image');
1991
2328
  });
2329
+ it('drops config hotkeys in a folder without a config', function () {
2330
+ waitsFor(function () {
2331
+ return huiTest.app.bodyView.hotkeys.bindings['group:Red'] === undefined;
2332
+ }, 'config hotkeys to be removed');
2333
+ });
1992
2334
  });
1993
2335
  });
@@ -0,0 +1,155 @@
1
+ /* global girderTest describe it expect girder $ */
2
+
3
+ girderTest.importPlugin('jobs', 'large_image', 'large_image_annotation', 'slicer_cli_web', 'histomicsui');
4
+
5
+ girderTest.promise.done(function () {
6
+ var hotkeys = girder.plugins.histomicsui.hotkeys;
7
+
8
+ // A keyboard event with only the properties the hotkeys module reads.
9
+ function ev(key, mods) {
10
+ return $.extend({key: key}, mods || {});
11
+ }
12
+ function fk(evt) {
13
+ return hotkeys.formatKey(hotkeys.bindingFromEvent(evt));
14
+ }
15
+
16
+ describe('Hotkeys module', function () {
17
+ describe('parsing and formatting', function () {
18
+ it('parses key strings', function () {
19
+ expect(hotkeys.formatKey(hotkeys.parseKey('S'))).toBe('shift+s');
20
+ expect(hotkeys.formatKey(hotkeys.parseKey('ctrl-alt-x'))).toBe('ctrl+alt+x');
21
+ expect(hotkeys.formatKey(hotkeys.parseKey('shift+-'))).toBe('-');
22
+ expect(hotkeys.formatKey(hotkeys.parseKey('ctrl++'))).toBe('ctrl+plus');
23
+ expect(hotkeys.formatKey(hotkeys.parseKey('ArrowLeft'))).toBe('left');
24
+ expect(hotkeys.parseKey('')).toBe(null);
25
+ });
26
+ it('applies explicit modifiers from a config entry', function () {
27
+ expect(hotkeys.formatKey(hotkeys.parseKey('r', {ctrl: true}))).toBe('ctrl+r');
28
+ });
29
+ it('formats keys for display', function () {
30
+ expect(hotkeys.displayKey(hotkeys.parseKey('ctrl+shift+s'))).toBe('Ctrl+Shift+S');
31
+ });
32
+ });
33
+
34
+ describe('keyboard events', function () {
35
+ it('reads keys from events', function () {
36
+ expect(fk(ev('S'))).toBe('shift+s');
37
+ expect(fk(ev('<', {shiftKey: true}))).toBe('<');
38
+ expect(fk(ev(' '))).toBe('space');
39
+ expect(fk({originalEvent: {key: 'x', altKey: true}})).toBe('alt+x');
40
+ expect(hotkeys.bindingFromEvent(ev('Shift', {shiftKey: true}))).toBe(null);
41
+ expect(hotkeys.bindingFromEvent(ev('CapsLock'))).toBe(null);
42
+ expect(hotkeys.bindingFromEvent(ev('NumLock'))).toBe(null);
43
+ });
44
+ it('ignores shift and ctrl for sized navigation actions', function () {
45
+ expect(hotkeys.formatKey(hotkeys.bindingFromEvent(ev('H', {shiftKey: true, ctrlKey: true}), true))).toBe('h');
46
+ });
47
+ });
48
+
49
+ describe('resolution', function () {
50
+ it('dispatches the default keys', function () {
51
+ var r = hotkeys.resolveHotkeys();
52
+ expect(hotkeys.actionForEvent(r, ev('s'))).toEqual({action: 'select.rectangle'});
53
+ expect(hotkeys.actionForEvent(r, ev('S'))).toEqual({action: 'select.polygon'});
54
+ expect(hotkeys.actionForEvent(r, ev('Escape'))).toEqual({action: 'draw.cancel'});
55
+ expect(hotkeys.actionForEvent(r, ev('s', {ctrlKey: true}))).toBe(null);
56
+ expect(hotkeys.actionForEvent(r, ev('ArrowLeft'))).toBe(null);
57
+ expect(hotkeys.geojsKeyboardActions(r)).toEqual({});
58
+ });
59
+ it('uses config group hotkeys and modifiers', function () {
60
+ var r = hotkeys.resolveHotkeys({
61
+ config: [
62
+ {key: 't', action: 'group', param: 'tumor'},
63
+ {key: 'x', action: 'group', param: 'stroma', ctrl: true},
64
+ {key: 'z', action: 'unknown'}
65
+ ]
66
+ });
67
+ expect(hotkeys.actionForEvent(r, ev('t'))).toEqual({action: 'group', param: 'tumor'});
68
+ expect(hotkeys.actionForEvent(r, ev('x'))).toBe(null);
69
+ expect(hotkeys.actionForEvent(r, ev('x', {ctrlKey: true}))).toEqual({action: 'group', param: 'stroma'});
70
+ expect(r.bindings.unknown).toBe(undefined);
71
+ });
72
+ it('lets config keys take keys from the defaults', function () {
73
+ var r = hotkeys.resolveHotkeys({config: [{key: 'r', action: 'group', param: 'Red'}]});
74
+ expect(hotkeys.actionForEvent(r, ev('r'))).toEqual({action: 'group', param: 'Red'});
75
+ expect(r.bindings['draw.rectangle']).toEqual([]);
76
+ });
77
+ it('applies user overrides over config', function () {
78
+ var r = hotkeys.resolveHotkeys({
79
+ config: [{key: 'r', action: 'draw.rectangle'}, {key: 't', action: 'group', param: 'A'}],
80
+ user: [
81
+ {key: 'x', action: 'draw.rectangle'},
82
+ {key: null, action: 'draw.point'},
83
+ {key: 't', action: 'draw.line'}
84
+ ]
85
+ });
86
+ expect(hotkeys.actionForEvent(r, ev('x'))).toEqual({action: 'draw.rectangle'});
87
+ expect(hotkeys.actionForEvent(r, ev('r'))).toBe(null);
88
+ expect(hotkeys.actionForEvent(r, ev('o'))).toBe(null);
89
+ expect(hotkeys.actionForEvent(r, ev('t'))).toEqual({action: 'draw.line'});
90
+ expect(r.bindings['group:A']).toEqual([]);
91
+ expect(r.source['draw.rectangle']).toBe('user');
92
+ });
93
+ });
94
+
95
+ describe('geojs and frame selector keys', function () {
96
+ it('expands rebound navigation keys for geojs', function () {
97
+ var r = hotkeys.resolveHotkeys({
98
+ user: [
99
+ {key: 'h', action: 'pan.left'},
100
+ {key: '1', action: 'group', param: 'Tumor'}
101
+ ]
102
+ });
103
+ expect(hotkeys.geojsKeyboardActions(r)).toEqual({
104
+ 'pan.left': ['h', 'shift+h', 'ctrl+shift+h'],
105
+ 'zoom.0': []
106
+ });
107
+ });
108
+ it('maps the default layer keys', function () {
109
+ var lh = hotkeys.layerHotkeys(hotkeys.resolveHotkeys());
110
+ expect(lh.layerForEvent(ev('1', {ctrlKey: true}))).toBe(0);
111
+ expect(lh.layerForEvent(ev('0', {ctrlKey: true}))).toBe(9);
112
+ expect(lh.layerForEvent(ev('1', {ctrlKey: true, altKey: true}))).toBe(10);
113
+ expect(lh.layerForEvent(ev('1'))).toBe(undefined);
114
+ expect(lh.labels[0]).toBe('Ctrl+1');
115
+ expect(lh.labels[19]).toBe('Ctrl+Alt+0');
116
+ });
117
+ it('maps rebound layer keys', function () {
118
+ var r = hotkeys.resolveHotkeys({
119
+ user: [
120
+ {action: 'layer.1', key: 'alt+q'},
121
+ {action: 'draw.point', key: 'ctrl+2'}
122
+ ]
123
+ });
124
+ var lh = hotkeys.layerHotkeys(r);
125
+ expect(lh.layerForEvent(ev('q', {altKey: true}))).toBe(0);
126
+ expect(lh.layerForEvent(ev('1', {ctrlKey: true}))).toBe(undefined);
127
+ expect(lh.layerForEvent(ev('2', {ctrlKey: true}))).toBe(undefined);
128
+ expect(hotkeys.actionForEvent(r, ev('2', {ctrlKey: true}))).toEqual({action: 'draw.point'});
129
+ });
130
+ });
131
+
132
+ describe('user file entries and titles', function () {
133
+ it('converts overrides to entries and back', function () {
134
+ var entries = hotkeys.overridesToEntries(
135
+ {'draw.point': [], 'group:tumor': [hotkeys.parseKey('ctrl+t')]},
136
+ {'group:tumor': {action: 'group', param: 'tumor'}});
137
+ expect(entries).toEqual([
138
+ {action: 'draw.point', key: null},
139
+ {action: 'group', param: 'tumor', key: 'ctrl+t'}
140
+ ]);
141
+ var r = hotkeys.resolveHotkeys({user: entries});
142
+ expect(hotkeys.actionForEvent(r, ev('t', {ctrlKey: true}))).toEqual({action: 'group', param: 'tumor'});
143
+ expect(r.bindings['draw.point']).toEqual([]);
144
+ });
145
+ it('fills keys into element titles', function () {
146
+ var el = document.createElement('div');
147
+ el.innerHTML = '<span data-hotkey-title="Select {select.rectangle}; {select.polygon}; {nope}"></span>';
148
+ hotkeys.setCurrentHotkeys(hotkeys.resolveHotkeys({user: [{action: 'select.rectangle', key: 'k'}]}));
149
+ hotkeys.applyHotkeyTitles(el);
150
+ expect(el.firstChild.getAttribute('title')).toBe('Select K; Shift+S; none');
151
+ hotkeys.setCurrentHotkeys(hotkeys.resolveHotkeys());
152
+ });
153
+ });
154
+ });
155
+ });
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "1.8.0",
3
- "distance": 222,
4
- "node": "gfb25136128cb8e67529f93549b61ece7f5a226b8",
5
- "dirty": false,
6
- "branch": "girder-5",
7
- "node_date": "2026-11-09"
8
- }