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

Solarer/split culling mode #13278

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Solarer
Copy link
Contributor

@Solarer Solarer commented Jan 4, 2023

This is the second attempt to split culling in a mode that is movement restricted to selection and one mode that is not restricted.
This is a prerequisite to get #6025 done.

No Change:

  • x enters culling. If images were selected, movement is restricted to selected images. If no images were selected, movement is not restricted.

Changes:

  • implemented a lock button in culling that shows up on the right side of the current zoom level. This button visualizes whether movement is restricted to selected images or not. Pressing the button toggles the restriction on and off.
  • Keybind c toggles the movement restriction on and off. If you are not in culling mode already, enter culling.

Issues:

  • Layout buttons shift a little left and right because of center alignment when restriction button appears/disappears.

(a first draft was attempted in PR #11112. I will leave that PR open for reference until this one has been merged.)

@Solarer
Copy link
Contributor Author

Solarer commented Jan 4, 2023

@AlicVB it has been some time but I found some time to code recently. Can you have a look at this?

@TurboGit TurboGit requested review from AlicVB and TurboGit January 4, 2023 21:03
@TurboGit TurboGit added the feature: redesign current features to rewrite label Jan 4, 2023
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

This pull request did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please verify it has no conflicts with the master branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.

@Solarer
Copy link
Contributor Author

Solarer commented May 31, 2023

@AlicVB
just a friendly ping to ask for your review.

@AlicVB
Copy link
Contributor

AlicVB commented Jun 12, 2023

OK, I've done a first try, after a looonng wait (sorry for that). I fear that I will ask you some questions already answered before, but well...

note that this has needed some rebasing (that's quite normal due to the age of the PR)
also there's lot of gtk-critical warnings, certainly related to the new button.

imho, we have 1 main issue here :
There's no more "automatic" startup switch between restricted and unrestricted mode. That means that users need to remember 2 shortcuts (and use theme accordingly) for the same feature, depending if a selection has been done or not... not really good imho. I wonder why you need to remove this feature ? Even in the case of a "selection-first" act-on algo, you may want to keep the "automatic" startup mode, no ?
If you absolutely need to have a way to enter non-automatic modes, maybe we can have something like :

  • c = unrestricted
  • ctrl-c = restricted
  • x = automatic

I fear that I still fail to understand the reason behind this change... (what is blocking exactly for your new act-on algo ?)

@AlicVB
Copy link
Contributor

AlicVB commented Jun 12, 2023

To go further with my difficulty to understand, I've read again PR #11112 where you say :

The changes in this PR are a prerequisit to everything in #10728 and #6025 because the new images_to_act_on algorithm prioritizes selected images over everything else and that would be a problem in culling because here a selection can act like a sub-collection (restricting movement). If we were to always act on all selected images, culling and culling dynamic would not work anymore.

esp. the last sentence : what exactly would not work anymore ? I can only see one :
Once in "restricted mode" all the images are selected, which means that any action will be applied on the whole set of images... in this case, yes it's a big problem that would void completely actual culling concept. But I wonder how the changes proposed here can solve it...
Let's take the context of the "classic" workflow : filter set to "all except rejected", and culling done by rejecteing "bad" images.

  • Do you plan to "unselect" all images as soon as you enter in culling ? Then effectively "restricted" mode is void (and dynamic too). In this case, if we want to keep this modes, the only thing I can think of is to put in memory the initial selection when entering culling, before the unselection, and then to refer to this list and not to the selection one...
  • Do you plan to have a "special case" for culling in order to not act on the whole selection ? But if I remember correctly that's not the case...

I really think I miss something...

@Solarer
Copy link
Contributor Author

Solarer commented Jun 13, 2023

There's no more "automatic" startup switch

That was unintended, my bad. I will fix that. x should still have the automatic behavior whereas c is always unrestricted. We do not need an explicit button for restricted since restricted does not make sense when there is no image selected and in that case you can just use x to enter restricted mode.

esp. the last sentence : what exactly would not work anymore ? I can only see one :
Once in "restricted mode" all the images are selected, which means that any action will be applied on the whole set of images... in this case, yes it's a big problem that would void completely actual culling concept. But I wonder how the changes proposed here can solve it...

That is the point and your second bullet point is how I want to solve it:

Do you plan to have a "special case" for culling in order to not act on the whole selection ? But if I remember correctly that's not the case...

For culling restricted I will ignore selection in images_to_act_on. Therefore I need to split the modes. (This is not included in this PR since we wanted to split this in separate PRs.)

@AlicVB
Copy link
Contributor

AlicVB commented Jun 13, 2023

great ! Thanks for the details...
So I will wait for your rebase and fix, and test again.

@Solarer Solarer requested a review from LebedevRI as a code owner June 25, 2023 20:14
@LebedevRI
Copy link
Member

This PR should probably be rebased, the diff is, uh,
image

@Solarer
Copy link
Contributor Author

Solarer commented Jun 26, 2023

Oh, I didn't mean to push to this repo. So I did not check it.
Yeah, will rebase

@Solarer Solarer force-pushed the solarer/split_culling_mode branch from 6e9b5fd to de7deb2 Compare July 3, 2023 22:08
@Solarer
Copy link
Contributor Author

Solarer commented Jul 3, 2023

  • Did a rebase of the code with master.
  • Fixed the issue of button x not behaving as expected.
  • Made some comments more verbose to better explain what each section of the code does

@Solarer Solarer force-pushed the solarer/split_culling_mode branch from de7deb2 to b072c1f Compare July 3, 2023 22:47
@Solarer
Copy link
Contributor Author

Solarer commented Jul 3, 2023

... forgot to squash my commits

@github-actions
Copy link

github-actions bot commented Sep 2, 2023

This pull request has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please verify it has no conflicts with the master branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.

@Solarer
Copy link
Contributor Author

Solarer commented Sep 3, 2023

still active and waiting for review from @AlicVB

@AlicVB
Copy link
Contributor

AlicVB commented Sep 3, 2023

I've just done another try... and I think there's still some issues :

  1. I've still some rebasing issues. I think that this is due to the fact that the git history before your commit is not clean for some reason. You can solve it by creating a new branch based on current master and adding your commit on top of it...
  2. both x and c switch to unrestricted mode
  3. if you select 4 images, with the cursor hovering one of the 4 selected images, and use ctrl-x you don't seems to enter the right mode... (culling with 2 images is shown). Everything is ok if you don't hover a selected image

I've not looked in the code to find where the issues come from, but I can if you need...

@Solarer
Copy link
Contributor Author

Solarer commented Sep 10, 2023

Thanks for finding the time.

  1. The rebasing issue is to be expected since other devs are not sitting by idle and pushing new code. I will do a final clean-up and rebase when functionality is ok.

  2. x still works the same "smart" way as it does on master: If images are selected it enters restricted mode and if no images are selected it goes to unrestricted.
    c is always unrestricted.
    I think this was what we agreed on but I can disable the logic so that x is always restricted if that makes more sense to you.

  3. Sorry but I was not able to reproduce this. From filemanager I always enter culling-dynamic no matter where I place the mouse. I did notice that I can not move from the other culling modes to culling dynamic via Ctrl-X - it returns me to filemanager layout. I added a new commit to address that, but this is not what you mean, right?

@AlicVB
Copy link
Contributor

AlicVB commented Sep 13, 2023

  1. The rebasing issue is to be expected since other devs are not sitting by idle and pushing new code. I will do a final clean-up and rebase when functionality is ok.

I'm far from a git specialist, but I fear the issue here is a little bit different, as I have to solve conflict in files absolutely not touched by your PR. I think the easiest way (at least it's what I'm doing) is to start from a copy of darktable/master and cherry-pick your 2 commits. This way, there's no conflict : it's straightforward !

For point 2 and 3, I've spotted the issue : it's a shortcut conflict with previous settings : if you remove shortcutrc files, no problem anymore (but that point needs to be solved anyway, as we can't ask users to delete their shortcutrc files ;))

Oh, and there's also still a bunch of Gtk-CRITICAL... (but I'm sure you are aware of this)

Copy link
Contributor

@AlicVB AlicVB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that can help you, here's where some gtk criticals comes from...

@AlicVB
Copy link
Contributor

AlicVB commented Jun 2, 2024

I've done a quick test. Just to be sure, I've spotted 2 changes :

  1. the new "c" shortcut to enter culling in "unrestricted" mode.
  2. the automatic mode (shortcut "x") as lost one aspect of the the automatic detection : now it switch between restricted/unrestricted based of the presence of a selection > 1 only. Before, it also check if the mouse hovered the selection or not...

So the question : was that mandatory for the next steps ? If not , I would prefer to keep that point as this...

Another question : full preview works the exact same way as culling for restricted/unrestricted. I've not spotted any change there, but do you plan to do some at some point ?

I'll try to have a look at the code asap, but I can't promise any delay........

@Solarer
Copy link
Contributor Author

Solarer commented Jun 2, 2024

I've done a quick test. Just to be sure, I've spotted 2 changes :
the new "c" shortcut to enter culling in "unrestricted" mode.

Yes, that was present starting with my first PR. All other view modes have a key binding and since culling starts with c and the keybinding is not in use, i picked that.

the automatic mode (shortcut "x") as lost one aspect of the the automatic detection : now it switch between restricted/unrestricted based of the presence of a selection > 1 only. Before, it also check if the mouse hovered the selection or not...
So the question : was that mandatory for the next steps ? If not , I would prefer to keep that point as this...

Err... honestly, I never noticed that before and I worked on this topic for 2 years... Can we just keep it the way it is now? It is just more straight forward. If someone selects images and then wants to enter unrestricted culling, they can now press c and it is done.

Another question : full preview works the exact same way as culling for restricted/unrestricted. I've not spotted any change there, but do you plan to do some at some point ?

Not planned. Act-on will continue to work only on the 1 full screen image. Since the filmstrip is hidden by default, nobody should be surprised that you interact with the one image the screen is showing you.

@AlicVB
Copy link
Contributor

AlicVB commented Jun 8, 2024

Err... honestly, I never noticed that before and I worked on this topic for 2 years... Can we just keep it the way it is now? It is just more straight forward. If someone selects images and then wants to enter unrestricted culling, they can now press c and it is done.

As soon as it's still not the case for full preview, I'm not sure it's really a critical issue.

Somme more remarks :

  • Unlike "x", "c" doesn't allow to exit culling mode. That has been done like that for "x" in order to facilitate the discovering of how to exit culling mode for beginners. It's also like that for "f" btw.
  • If you have a selection (with enough images) and you hover an image outside. Pressing "x" start in "restricted" mode (right, see last comments). But the image (in the selection) where culling start depends of which image is hovered. Esp. if one hovered an image after the selection, culling start at the last images of the selection. imho that's strange as we can crawl in selection in normal order
  • We have lost the "selection synchronization" in culling mode. Was that mandatory ? Imho that's not a critical feature, but I want to be sure it's not an unwanted side effect of your changes.

@Solarer
Copy link
Contributor Author

Solarer commented Jun 11, 2024

Unlike "x", "c" doesn't allow to exit culling mode. That has been done like that for "x" in order to facilitate the discovering of how to exit culling mode for beginners. It's also like that for "f" btw.

I implemented "c" to act like a switch to activate or deactivate the restricted movement. Since it is not a real view mode (at least it is not listed with the other ones in the UI) it did not feel right when it could be used to return to filemanager layout. I tested both and found this to be more natural.

We have lost the "selection synchronization" in culling mode. Was that mandatory ? Imho that's not a critical feature, but I want to be sure it's not an unwanted side effect of your changes.

We lost that some 2 years ago but nobody noticed 😅. It was not my doing. What is selected or not does not matter for this PR here - but it will matter for the act on code later. I suggest to revisit the synchronisation when we work on that.

If you have a selection (with enough images) and you hover an image outside. Pressing "x" start in "restricted" mode (right, see last comments). But the image (in the selection) where culling start depends of which image is hovered. Esp. if one hovered an image after the selection, culling start at the last images of the selection. imho that's strange as we can crawl in selection in normal order

If a mouse-over is available, the code tries to start culling there. Since "x" forces the restriction to selected images it snaps to the next selected image. If we are past the final image in the selection it snaps back.
I did not implement it that way (just default behavior) but I can change it. I guess it does make sense to start at the beginning by default.

@Solarer
Copy link
Contributor Author

Solarer commented Jun 11, 2024

Pushed a refined version. Also removed a
#include "common/collection.h"
Because my IDE said it is not required. Compiles just fine without it as far as I can tell

@AlicVB
Copy link
Contributor

AlicVB commented Jun 22, 2024

I implemented "c" to act like a switch to activate or deactivate the restricted movement. Since it is not a real view mode (at least it is not listed with the other ones in the UI) it did not feel right when it could be used to return to filemanager layout. I tested both and found this to be more natural.

From an user POV, I think that this can be really confusing, as "X", "F", etc don't work like that. But that's not really critical. Let's see what other think...

We lost that some 2 years ago but nobody noticed 😅. It was not my doing. What is selected or not does not matter for this PR here - but it will matter for the act on code later. I suggest to revisit the synchronisation when we work on that.

Oops... you're right. That's an indication of an unneeded feature, I guess ;) Maybe we can clean up last bit of related code then...

If a mouse-over is available, the code tries to start culling there. Since "x" forces the restriction to selected images it snaps to the next selected image. If we are past the final image in the selection it snaps back.
I did not implement it that way (just default behavior) but I can change it. I guess it does make sense to start at the beginning by default.

iirc, the code you mention is manly used to move to the nearest image when browsing in a "restricted" mode. That point should remain. But if possible, I agree with you that for the "starting" case, it would be better to go to the beginning...

@Solarer
Copy link
Contributor Author

Solarer commented Jun 24, 2024

Ok, I believe that is all for now. So I will wait for your approval and merge now that 4.8 is out

@AlicVB
Copy link
Contributor

AlicVB commented Jul 10, 2024

Well, my 3 comments above are still actual I think...

Esp, it would be great to have some opinions on :

From an user POV, I think that this can be really confusing, as "X", "F", etc don't work like that. But that's not really critical. Let's see what other think...

And to fix :

iirc, the code you mention is manly used to move to the nearest image when browsing in a "restricted" mode. That point should remain. But if possible, I agree with you that for the "starting" case, it would be better to go to the beginning...

@wpferguson (as you have volunteered to review), @TurboGit, etc

@Solarer
Copy link
Contributor Author

Solarer commented Jul 10, 2024

@AlicVB I already implemented that fix in my last commit. It should now start with the first image.

About the c button I left my reasoning above. Of course others should test this for themselves

I implemented "c" to act like a switch to activate or deactivate the restricted movement. Since it is not a real view mode (at least it is not listed with the other ones in the UI) it did not feel right when it could be used to return to filemanager layout. I tested both and found this to be more natural.

@AlicVB
Copy link
Contributor

AlicVB commented Jul 10, 2024

@AlicVB I already implemented that fix in my last commit. It should now start with the first image.

Oh great ! no idea why I have missed that, I may have done the test before your last commit... Sorry !

So there's just the c button shortcut then... let's wait for other opinions (otherwise everything ok for me)

@wpferguson
Copy link
Member

Testing...

These are some observations from just trying to use it.

Did someone request the restricted/unrestricted mode? Toggling in and out of it can be rather disorienting.

For instance:

  • I select 10 images and go into fixed culling mode with 5 images displayed. I go into restricted mode. I hover over the second image then toggle out of restricted mode and back into it. The second image becomes the first. The next time I toggle the images shift again.
  • If I go into unrestricted mode, scroll way past the end of the selection, then hit restricted it jumps back to the selection. I know this is the way it's supposed to work, but I find it disorienting.
  • In restricted mode and I change the number of images displayed from 5 to 2. I exit restricted mode and the display changes back to 5 images displayed.
  • If I move the mouse so it's not over any images and then hit a rating button all the images are assigned the rating. I was surprised by this, thinking that since I wasn't over an image no image would get rated.

My thought process about restricted mode is if I make a selection then go into culling mode, culling should be restricted to the selection. Why would I go to the effort of making a selection before culling if I didn't want culling restricted to the selection?

Copy link
Contributor

@AlicVB AlicVB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some more test in "real work" with a lot of images, I came to the conclusion that we lost here a quite important feature when using shortcuts :
Actually, when you have a selection set (let's say 10 selected images of 50), if you hover an image from the selection, you enter culling in restricted mode. If you hover an image outside this selection you enter culling in unrestricted mode, starting with the image hovered.
That quite handy imho, and this is consistent with the rest of darktable : fullpreview, darkroom, etc...

The proposed changes allow to keep this feature intact for current algo, and is future proof for a new algo (here "selection driven act_on")

Comment on lines +327 to +337
int sel_count = 0;
sqlite3_stmt *stmt;
// clang-format off
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"SELECT count(*) "
"FROM memory.collected_images AS col, main.selected_images as sel "
"WHERE col.imgid=sel.imgid",
-1, &stmt, NULL);
// clang-format on
if(sqlite3_step(stmt) == SQLITE_ROW) sel_count = sqlite3_column_int(stmt, 0);
sqlite3_finalize(stmt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we replace all that by : int sel_count = dt_act_on_get_images_nb(TRUE, FALSE); that will :

  • simplify the code
  • avoid current behavior change with current algo
  • be future proof once the new algo is done as it will propose another way to compute dt_act_on_get_images_nb. esp in the "selection driven algo", it will return the nb of selected images

Comment on lines +233 to +243
int sel_count = 0;
sqlite3_stmt *stmt;
// clang-format off
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"SELECT count(*) "
"FROM memory.collected_images AS col, main.selected_images as sel "
"WHERE col.imgid=sel.imgid",
-1, &stmt, NULL);
// clang-format on
if(sqlite3_step(stmt) == SQLITE_ROW) sel_count = sqlite3_column_int(stmt, 0);
sqlite3_finalize(stmt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@AlicVB
Copy link
Contributor

AlicVB commented Jul 12, 2024

Did someone request the restricted/unrestricted mode?

iiuc, this is needed, because in the context of a "selection driven act_on" algo, as soon as some selection is set, there would be no way to enter culling in unrestricted mode. @Solarer : I'm right ?

My thought process about restricted mode is if I make a selection then go into culling mode, culling should be restricted to the selection. Why would I go to the effort of making a selection before culling if I didn't want culling restricted to the selection?

I tend to agree with you here...

Maybe we can find a middle way by making the "rectricted" icon just an indicator and not a switch button ? I'm not sure the switch between restricted and unrestricted mode is useful in any workflow (apart to correct an initial mistake of the user, but in this case exit/reentering culling is not so hard...)
That would also "solve" my concern about the c shortcut that behave differently from x or f on second press...

@Solarer
Copy link
Contributor Author

Solarer commented Jul 16, 2024

@wpferguson and @AlicVB: I am on vacation for 2 weeks without a computer so I cannot test your findings right now. I will come back to it once I am back at home.

iiuc, this is needed, because in the context of a "selection driven act_on" algo, as soon as some selection is set, there would be no way to enter culling in unrestricted mode. @Solarer : I'm right ?

The main reason for the split is that a selection driven act_on will always prioritize selected images if they exist. In the culling workflow you always have some selected images to restrict your movement but you still want to be able to apply star ratings to INDIVIDUAL images from that selection - if selection is prioritized all would receive the same rating.

So I need to make an exception in the algorithm in case selection in culling is used for movement restriction. The split allows me to check for that and act accordingly.

@AlicVB was referring to the people who use the culling view mode like file manager layout. They enter without selection, move freely around the collection and select images for export and other actions. When they enter another view mode and return, they are stuck in the selection. The button/shortcut gives them a way back to unrestricted movement.

@Solarer
Copy link
Contributor Author

Solarer commented Jul 16, 2024

The shortcut is not necessary for the act_on code but that is just 2 more lines of code to fix the dead lock I just described. And I am rewriting that code anyways.

Whether it's a toggle or works the same as x and f does not matter and can be changed. It just looks more like a toggle button in the UI. So I implemented it in that way.

I can confirm findings 1 and 3 of @wpferguson and know how to address them.
Finding 2 is by design.
Finding 4 was always that way. I did not change that. Arrow keys will reset focus to the first image if you stop moving the mouse.

@Solarer
Copy link
Contributor Author

Solarer commented Jul 28, 2024

Back from vacation

@wpferguson

I select 10 images and go into fixed culling mode with 5 images displayed. I go into restricted mode. I hover over the second image then toggle out of restricted mode and back into it. The second image becomes the first. The next time I toggle the images shift again.

fixed. (Regarding the disorientation you mentioned I would like to point out that there is no need to press c multiple times in a row and that nobody is really meant to do that.)

In restricted mode and I change the number of images displayed from 5 to 2. I exit restricted mode and the display changes back to 5 images displayed.

fixed

@AlicVB

if we replace all that by : int sel_count = dt_act_on_get_images_nb(TRUE, FALSE);

That will not work. We are trying to decide whether we want to enter restricted or unrestricted mode and that decision is not about the number of images that will be acted on but rather whether a selection is present or not. If 1 image is selected, we want to enter culling restricted. If 0 images are selected but 1 image is hovered over by the mouse we want to enter unrestricted. Yet, it both cases dt_act_on_get_images_nb would return 1 as the number of images to act on.

Copy link

This pull request has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please verify it has no conflicts with the master branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.

@AlicVB
Copy link
Contributor

AlicVB commented Sep 27, 2024

That will not work. We are trying to decide whether we want to enter restricted or unrestricted mode and that decision is not about the number of images that will be acted on but rather whether a selection is present or not. If 1 image is selected, we want to enter culling restricted. If 0 images are selected but 1 image is hovered over by the mouse we want to enter unrestricted. Yet, it both cases dt_act_on_get_images_nb would return 1 as the number of images to act on.

When implementing culling (and reworking full preview) there has been a design decision to not consider selection of 1 image as a "real" selection but more as a starting point, so to enter unrestricted mode in this case.
You can see that behavior actually if you select 1 image and enter culling with toolbar button or hover the selected image and press culling shortcut.

Is there any imperative reason to change that in the context of "selection driven" algo ?

@Solarer
Copy link
Contributor Author

Solarer commented Oct 4, 2024

Ok, then it should work in case of hovering 1 image.

Copy link

github-actions bot commented Dec 4, 2024

This pull request has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please verify it has no conflicts with the master branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: redesign current features to rewrite no-pr-activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants