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

MacOS -> macOS #418

Merged
merged 1 commit into from
May 3, 2024
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
2 changes: 1 addition & 1 deletion docs/developers/contributing/dev_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ In order to make changes to `napari`, you will need to [fork](https://docs.githu
:::

:::{tab-item} Using `venv`
After installing Python on your machine, create a virtual environment on your terminal and activate it. On Linux and MacOS, you can run
After installing Python on your machine, create a virtual environment on your terminal and activate it. On Linux and macOS, you can run
```sh
python -m venv <path-to-env>
source <path-to-env>/bin/activate
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/contributing/performance/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Once the file is saved, you can investigate using free tools. Some options inclu
You can install graphviz with system package managers:

* Ubuntu: `sudo apt install graphviz`
* MacOS with brew: `brew install graphviz`
* macOS with brew: `brew install graphviz`
* Windows with choco `choco install graphviz`

You can then use `gprof2dot`, a Python library, to convert the `.pstat`
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/rendering-explanation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The issue is not just aesthetic. Manipulating user interface elements like
sliders becomes almost impossible if the framerate is really slow. This
creates a deeply frustrating experience for the user. Furthermore, if
napari "blocks" for several seconds, the operating system might indicate to
the user that the application is hung or has crashed. For example MacOS
the user that the application is hung or has crashed. For example macOS
will show the "spinning wheel of death". This is clearly not acceptable.

A fast average framerate is important, but it's also important that napari
Expand Down
2 changes: 1 addition & 1 deletion docs/howtos/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ which would build a Docker image tagged with napari version.
First, make sure there's a running X server on the host machine.
These can be useful if you are looking for options:
* Windows: [vcxsrc](https://sourceforge.net/projects/vcxsrv/)
* MacOS: [xquartz](https://www.xquartz.org/) (may not work due to graphical driver issue with opengl)
* macOS: [xquartz](https://www.xquartz.org/) (may not work due to graphical driver issue with opengl)

To run a container with external mapping of display, an example being:

Expand Down
14 changes: 7 additions & 7 deletions docs/naps/7-key-binding-dispatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Here are some examples:
- `alt` is **valid** as a base key because it contains no other modifiers and no other parts
- `alt+meta` is **invalid** because it is a key combination comprised of only modifiers
- `alt+t` is **valid** as a key combination
- `alt t` is **invalid** because it is a key chord whose first part is a single modifier
- `alt t` is **invalid** because it is a key chord whose first part is a single modifier
- `ctrl+x alt` is **invalid** because it is a key chord whose second part is a single modifier
- `ctrl+x alt+v` is **valid** as a key chord
- `meta meta` is **invalid** because it is a key chord comprised of only single modifier parts
Expand Down Expand Up @@ -91,7 +91,7 @@ class KeyBindingEntry:
when: Optional[Expr] = field(compare=False)
block_rule: bool = field(init=False)
negate_rule: bool = field(init=False)

def __post_init__(self):
self.block_rule = self.command_id == ''
self.negate_rule = self.command_id.startswith('-')
Expand Down Expand Up @@ -270,7 +270,7 @@ def has_conflicts(key: int, keymap: Dict[int, List[KeyBindingEntry]]) -> bool:
for _, entries in filter(conflict_filter, keymap.items()):
if find_active_match(entries):
return True

return False
```

Expand Down Expand Up @@ -331,7 +331,7 @@ class KeyBindingDispatcher:
key_seq = mods | key
if self.prefix:
key_seq = KeyChord(self.prefix, key_seq)

if (entries := self.keymap.get(key_seq) and (match := find_active_match(entries)):
self.active_combo = mods | key
if not self.prefix and has_conflicts(key_seq, self.keymap):
Expand Down Expand Up @@ -410,7 +410,7 @@ Out of scope is work related to the GUI and how it may have to handle the new sy

## Alternatives

Although a mapping approach is very effective for looking up individual keys, it loses its efficiency when performing a partial search, since its items are traversed like a list to perform that search.
Although a mapping approach is very effective for looking up individual keys, it loses its efficiency when performing a partial search, since its items are traversed like a list to perform that search.

This inefficiency can be mitigated by using a data structure where entries are stored similar to a _[trie](https://en.wikipedia.org/wiki/Trie)_ (aka a _prefix tree_). Since modifier keys do not care about what order they are pressed in, we will use a [directed acyclic graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) instead of a traditional tree, essentially making this a _prefix [multitree](https://en.wikipedia.org/wiki/Multitree)_.

Expand Down Expand Up @@ -448,7 +448,7 @@ In the mapping case, imagine that every possible valid key binding has at least

On the other hand, for a prefix tree, the amount of options for each node would be at most _K - D_, where _D_ is the depth of the node relative to the last completed part. When searching a key sequence with 4 modifiers for each part, the maximum number of options visited for one part would be _K + (K-1) + (K-2) + (K-3) + (K-4)_, or _2(5K-10)_ for two parts, resulting in a conflict search runtime complexity of _O(log(n))_.

Therefore, when searching for indirect conflicts, using a prefix-based data structure would be more efficient than a mapping-based one. However, when [put to a test on VSCode's default key bindings](https://gist.github.com/kne42/82d20e0ed48ccef0ac30aee7c2924b79), which are comprised of approximately 900 entries, the difference in speed was not significant, with the prefix tree approach finishing only 59ms faster with an average of 109ms over the mapping one with an average of 168ms over 700 runs. For the test, `when` conditionals were simulated to take 3µs to evaluate and both methods were searching for the conflict of the most common modifier (which would be `Ctrl` on Windows/Linux or `Cmd` on MacOS).
Therefore, when searching for indirect conflicts, using a prefix-based data structure would be more efficient than a mapping-based one. However, when [put to a test on VSCode's default key bindings](https://gist.github.com/kne42/82d20e0ed48ccef0ac30aee7c2924b79), which are comprised of approximately 900 entries, the difference in speed was not significant, with the prefix tree approach finishing only 59ms faster with an average of 109ms over the mapping one with an average of 168ms over 700 runs. For the test, `when` conditionals were simulated to take 3µs to evaluate and both methods were searching for the conflict of the most common modifier (which would be `Ctrl` on Windows/Linux or `Cmd` on macOS).

Although the prefix tree is approximately 50% faster at finding indirect conflicts, a difference of ~60ms is not significant enough to be noticed by the user. It then comes down to other factors to determine which implementation is better. While a prefix tree approach would be able to handle more than two-part key bindings, it is arguable that any more parts might be confusing to the user. It's also possible to save the "state" of the search in the sense of narrowing down to a specific node, which may be useful for key binding completion.

Expand All @@ -475,4 +475,4 @@ CC0+BY [^id5].
[^id4]: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication,
<https://creativecommons.org/publicdomain/zero/1.0/>

[^id5]: <https://dancohen.org/2013/11/26/cc0-by/>
[^id5]: <https://dancohen.org/2013/11/26/cc0-by/>
3 changes: 1 addition & 2 deletions docs/release/release_0_4_17.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ or create issues on GitHub.
- remove a few more qtbot.wait calls in tests (#4888)
- use npe2api in plugin install dialog (#4893)
- Add perfmon directory for shared configs and tools (#4898)
- Conda: fix MacOS signing (#4904)
- Conda: fix macOS signing (#4904)
- Improve error message for a failed write (#4913)
- Minor type fix (add Optional) (#4916)
- add user keymap (#4946)
Expand Down Expand Up @@ -472,4 +472,3 @@ or create issues on GitHub.
- [Robin Koch](https://github.com/napari/napari/commits?author=RobAnKo) - @RobAnKo
- [Talley Lambert](https://github.com/napari/napari/commits?author=tlambert03) - @tlambert03
- [Ziyang Liu](https://github.com/napari/napari/commits?author=potating-potato) - @potating-potato

2 changes: 1 addition & 1 deletion docs/tutorials/fundamentals/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pip install napari[all, pyqt] -c constraints_py3.10.txt
## Install as a bundled app

napari can also be installed as a bundled app on each of the major platforms,
MacOS, Windows, and Linux with a simple one-click download and installation
macOS, Windows, and Linux with a simple one-click download and installation
process. You might want to install napari as a bundled app if you are unfamiliar
with installing Python packages or if you were unable to get the installation
process described above working. The bundled app version of napari is the same
Expand Down
Loading