# Segmentations module: clicking on slider track should move slider in steps; spinner should increment last digit

**URL:** <https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376>\
**Category:** Feature requests\
**Created:** [October 27, 2021, 4:28am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376 "2021-10-27T04:28:32Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![DIV](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/div/32/12816_2.png) [@DIV](https://discourse.slicer.org/u/DIV)\
**Post date:** [October 27, 2021, 4:28am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/1 "2021-10-27T04:28:32Z")

</div>

The **Segmentations** module has several sliders in the _Display_ panel, all showing values from 0.00 to 1.00 (to two decimal places). These are accompanied by number boxes (text fields) with spinners, and tick-boxes (check-boxes).

Current behaviour:

- **tick-box** toggles the _effective_ value to either 0.00 or the user’s preference;
- dragging the **slider knob** moves in steps of size 0.10;
- clicking the **slider rail** jumps to either 0.00 or 1.00;
- clicking the **spinner** moves in steps of size 0.10;
- any desired (valid) number can be typed into the **text field**.

Desired behaviour:

- **tick-box** toggles the _effective_ value to either 0.00 or the user’s preference (_no change_);
- dragging the **slider knob** moves in steps of size 0.05 or 0.01 (_medium or fine resolution_);
- clicking the **slider rail** moves in steps of size 0.10 (_coarse resolution_);
- clicking the **spinner** moves in steps of size 0.05 or 0.01 (_medium or fine resolution_);
- any desired (valid) number can be typed into the **text field** (_no change_).

The suggested GUI changes are consistent with the behaviour of vertical scrollbars in a wide variety of applications such as in word processing, PDF document reading/editing, and spreadsheet processing. That is, clicking the scrollbar acts like `Page up` or `Page down` (large steps), _not_ like `Home` or `End`; dragging the scrollbar allows fine control (steps as small, or smaller, than by clicking the arrows at the end of the bar).

The current behaviour of clicking the slider rail is particularly useless, because most of the sliders start with a default value of 1.00, so the current slider rail behaviour in those cases is a redundant duplication of the tick-box.

—DIV

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [October 27, 2021, 4:16pm UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/2 "2021-10-27T16:16:22Z")

</div>

Code in question lives here:

> <https://github.com/Slicer/Slicer/blob/5a86e3f0d83a50deb1a2e289f7213058f7ef6556/Modules/Loadable/Segmentations/Widgets/Resources/UI/qMRMLSegmentationDisplayNodeWidget.ui#L60-L66>

> [@DIV](#):
>
> dragging the **slider knob** moves in steps of size 0.05 or 0.01 ( _medium or fine resolution_ );

> [@DIV](#):
>
> clicking the **spinner** moves in steps of size 0.05 or 0.01 ( _medium or fine resolution_ );

^ These would both be accomplished by changing the `singleStep` property to the desired new value.

> [@DIV](#):
>
> clicking the **slider rail** moves in steps of size 0.10 ( _coarse resolution_ );

^ This would be accomplished by changing the `pageStep` property to the desired new value.

@DIV Could you issue a PR [Pull requests · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pulls) with these changes?

---

<div class="post-metadata">

**Author:** ![DIV](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/div/32/12816_2.png) [@DIV](https://discourse.slicer.org/u/DIV)\
**Post date:** [October 28, 2021, 1:08am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/3 "2021-10-28T01:08:01Z")

</div>

> [@jamesobutler](#):
>
> @DIV Could you issue a PR [Pull requests · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pulls) with these changes?

I’d rather leave it to the experts 😛  
Otherwise you’ll have to step me through the process. I clicked on the link, and read some documentation, but for a pull request it seems I must maybe make a new branch or a new fork or make some edits on an existing branch? At the link for the code the pencil editing button shows “_You must be on a branch to make or propose changes to this file_”.  
—DIV

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 28, 2021, 4:16am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/4 "2021-10-28T04:16:09Z")

</div>

Page size is typically 30% in most of the percentage sliders, but I agree that **10% page step** would be a bit more useful.

Step size in Powerpoint is set so that you can get from 0% to 100% using the up/down spin sliders in about 6 seconds. This would mean about **5% single step size** in Slicer (on my computer).

> [@DIV](#):
>
> At the link for the code the pencil editing button shows “ _You must be on a branch to make or propose changes to this file_ ”.

You can go on and make the change and github will offer to create the fork. So, modifying a single file and creating a pull request is trivial.

However, we would need to the change all the 0-100% sliders across the application the same way (unless there is a specific reason to make the step sizes different). That would mean modifying several .ui files. For this, after github creates the fork and branch, you can go to your fork and modify additional .ui files there. Github will add those changes to the pull request automatically.

You experiment with github and creating pull requests, forking the repository, etc. as you cannot mess up anything in the official Slicer repository.

---

<div class="post-metadata">

**Author:** ![DIV](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/div/32/12816_2.png) [@DIV](https://discourse.slicer.org/u/DIV)\
**Post date:** [October 29, 2021, 3:02am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/5 "2021-10-29T03:02:05Z")

</div>

> [@lassoan](#):
>
> Page size is typically 30% in most of the percentage sliders, but I agree that **10% page step** would be a bit more useful.
> 
> Step size in Powerpoint is set so that you can get from 0% to 100% using the up/down spin sliders in about 6 seconds. This would mean about **5% single step size** in Slicer (on my computer).

Sounds reasonable, and I think compatible with my suggestions.

> [@lassoan](#):
>
> > [@DIV](#):
> >
> > At the link for the code the pencil editing button shows “ _You must be on a branch to make or propose changes to this file_ ”.
> 
> You can go on and make the change and github will offer to create the fork. So, modifying a single file and creating a pull request is trivial.
> 
> However, we would need to the change all the 0-100% sliders across the application the same way (unless there is a specific reason to make the step sizes different). That would mean modifying several .ui files. For this, after github creates the fork and branch, you can go to your fork and modify additional .ui files there. Github will add those changes to the pull request automatically.
> 
> You experiment with github and creating pull requests, forking the repository, etc. as you cannot mess up anything in the official Slicer repository.

Then it sounds like someone (or a small team) with excellent familiarity with the whole project would be better placed to make these changes systematically across all of the relevant files.

I am not completely averse to experimenting and making changes on github, although it would be nice to have some basic pointers — like which branch to work with (nightly? 4.11?), or how to make the edit if the ‘pencil’ button just produces an error. Not much point spending time making changes on files that that nobody else can access, for example, or which can’t be readily merged with the ‘active’ development code.  
Of course, there’s also a balance in allocating the time between my ‘day job’ and learning about github & perhaps making some small contributions there.

—DIV

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 29, 2021, 3:32am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/6 "2021-10-29T03:32:19Z")

</div>

> [@DIV](#):
>
> like which branch to work with (nightly? 4.11?),

All developments and fixes are done in the master branch.

> [@DIV](#):
>
> how to make the edit if the ‘pencil’ button just produces an error

We don’t do anything special in Slicer’s github repository. Suggesting file modification works the same way as in all other repositories.

The _You must be on a branch to make or propose changes to this file_ message means\* that you need to choose a branch where you want to modify the file on. So, select the `master` branch in the version selector near the top-left corner:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/1/813ad5df76ffecbc7f78b902974a7b7b2fc99066.png)

> [@DIV](#):
>
> Not much point spending time making changes on files that that nobody else can access, for example, or which can’t be readily merged with the ‘active’ development code.

All of Slicer’s source code is on github, you have full read access the latest master version, which is the same that all developers are actively working on. You also have full write access on your fork (that github creates for you automatically when you edit a file). You can make all changes in your fork and then create a pull request to ask for your proposed changes integrated into the official repository.

> [@DIV](#):
>
> Of course, there’s also a balance in allocating the time between my ‘day job’ and learning about github & perhaps making some small contributions there.

We appreciate your feedbacks (it is particularly valuable to get perspective of a new user). Learning the github contribution process can be useful in general and finding percentage sliders in the Slicer GUI takes similar effort for everyone, but if you cannot work on these now it is fine, we understand that you need to prioritize (same for all of us). Just let us know what you plan to do to make sure there is a follow up.

---

<div class="post-metadata">

**Author:** ![DIV](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/div/32/12816_2.png) [@DIV](https://discourse.slicer.org/u/DIV)\
**Post date:** [November 1, 2021, 5:20am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/7 "2021-11-01T05:20:16Z")

</div>

> [@lassoan](#):
>
> We don’t do anything special in Slicer’s github repository. Suggesting file modification works the same way as in all other repositories.

I just wasn’t familiar with the ‘usual’ way of doing things on GitHub either.  
FWIW, perhaps for others on the forum, I also came across these “[Contributing to Slicer](https://github.com/Slicer/Slicer/blob/a15cbacbb91a3f187a8cd80c00bbb232e881f48b/CONTRIBUTING.md)” guidelines. Somewhat over my head, though.

> [@lassoan](#):
>
> > [@DIV](#):
> >
> > Not much point spending time making changes on files that that nobody else can access, for example, or which can’t be readily merged with the ‘active’ development code.
> 
> All of Slicer’s source code is on github, you have full read access the latest master version, which is the same that all developers are actively working on. You also have full write access on your fork (that github creates for you automatically when you edit a file). You can make all changes in your fork and then create a pull request to ask for your proposed changes integrated into the official repository.

Re-reading my comment, I realise it may have been unclear. I was not making an assumption or assertion, and I wasn’t referring to the branches that I can see (which must _ipso facto_ be public). I was indicating that _hypothetically_ — for all I know — I might end up creating a ‘private fork’ (if such a thing exists) that nobody else can access.  
Anyway, I’ve had a go now, and maybe it will work.

> [@lassoan](#):
>
> > [@DIV](#):
> >
> > Of course, there’s also a balance in allocating the time between my ‘day job’ and learning about github & perhaps making some small contributions there.
> 
> We appreciate your feedbacks (it is particularly valuable to get perspective of a new user). Learning the github contribution process can be useful in general and finding percentage sliders in the Slicer GUI takes similar effort for everyone, but if you cannot work on these now it is fine, we understand that you need to prioritize (same for all of us). Just let us know what you plan to do to make sure there is a follow up.

I’ve had a go on the indicated file for the Segmentations module, which was the interface that was bothering me. If nothing else, at least this might give an indication as to whether my Pull Request ended up in the right place.  
I haven’t touched any other files/modules, and don’t have that as a priority.

I appreciate your additional help in introducing me to the GitHub process. Like most things, I imagine that the learning curve is steeper at the start.

—DIV

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 1, 2021, 8:27pm UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/8 "2021-11-01T20:27:40Z")

</div>

Your pull request has been merged. Page/single step of percentage sliders will be updated in tomorrow’s Slicer Preview Release. Thank you for your contribution.

---

<div class="post-metadata">

**Author:** ![DIV](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/div/32/12816_2.png) [@DIV](https://discourse.slicer.org/u/DIV)\
**Post date:** [April 5, 2022, 7:56am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/9 "2022-04-05T07:56:23Z")

</div>

Could someone with knowledge of github please take a look at

> <https://github.com/Slicer/Slicer/pull/6295#>
>
> Can maybe also delete 
> \<property name="SingleStep" stdset="0"\>
> \<doubl…e\>0.050000000000000\</double\>
> as duplication.

I tried making some basic changes to the slider code in the **Model** module but I am getting errors such as

```auto
Modules/Scripted/SegmentStatistics/SegmentStatistics.py:559: [B020] Found for loop that reassigns the iterable it is iterating with each iterable value.
    for name in {name for name in uniqueHeaderNames if uniqueHeaderNames.count(name)>1}:
        ^

Error: The process '/opt/hostedtoolcache/Python/3.9.12/x64/bin/pre-commit' failed with exit code 1

```

which may be nothing to do with my changes.

I also tried to amend my own changes, but not sure if that was done correctly.

—DIV

---

<div class="post-metadata">

**Author:** ![DIV](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/div/32/12816_2.png) [@DIV](https://discourse.slicer.org/u/DIV)\
**Post date:** [April 6, 2022, 4:46am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/10 "2022-04-06T04:46:46Z")

</div>

It also fails “ **CommitCheck** — Not all of your commit messages are valid.”, but I am unable to see what is the offending part of the message.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [April 6, 2022, 1:26pm UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/11 "2022-04-06T13:26:08Z")

</div>

You can learn a little about CommitCheck from the post below or more directly at [Style Guide — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/developer_guide/style_guide.html#commits).

> [@Commit message prefix](https://discourse.slicer.org/t/commit-message-prefix/10921):
>
> As discussed in [this issue](https://github.com/Slicer/Slicer/pull/4783#issuecomment-605662343), the DOC: prefix is now valid when writing commit message. The [Commit Style Guide](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Style_Guide#Commits) and the [commit check](https://www.commitcheck.com) have both been updated. For reference, here is the regex used to validate the commit title: (BUG|COMP|DOC|ENH|PERF|STYLE)\: \w+

---

<div class="post-metadata">

**Author:** ![DIV](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/div/32/12816_2.png) [@DIV](https://discourse.slicer.org/u/DIV)\
**Post date:** [April 7, 2022, 1:43am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/12 "2022-04-07T01:43:15Z")

</div>

Thanks, James.  
I do now recall that a prefix was mentioned in one of the guides, which I omitted.  
So I think I have fixed that, although there seems to be no way to get the check to be re-run (except perhaps making more edits to the code).

Also the link on GitHub to “[Details](https://www.commitcheck.com/status/Slicer/Slicer/b98e6eb8-3231-4faa-8ed4-e97decab7966)” of the CommitCheck check doesn’t work for me.  
I click and get taken immediately to `https://www.commitcheck.com/401`, which says “\_ Something went wrong … You may have been logged out.\_” and provides a button to “_Log in with GitHub_” …but when I click to do that, I’m taken to `https://www.commitcheck.com/users/auth/github`, which shows only “_Not found. Authentication passthru._”.

Any ideas on the linting error?  
At this point I’m guessing that the code hasn’t changed, but the linting check has been modified since the original code was written.

—DIV

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [April 7, 2022, 3:24am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/13 "2022-04-07T03:24:19Z")

</div>

CommitCheck is checking the prefix of the Commits in the PR and not the PR title as you have recently updated. Your PR currently includes commits titled `Harmonising slider step sizes.` and `Update qMRMLModelDisplayNodeWidget.ui` which neither have an appropriate commit prefix. You should be able to find resources online discussing how to squash and amend commits. I suggest you practice in a separate branch first before pushing updates to the branch corresponding to your PR.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 21, 2023, 2:02am UTC](https://discourse.slicer.org/t/segmentations-module-clicking-on-slider-track-should-move-slider-in-steps-spinner-should-increment-last-digit/20376/14 "2023-03-21T02:02:13Z")

</div>


